· 5 years ago · Mar 05, 2020, 12:40 AM
1.mode column
2.headers on
3
4DROP TABLE IF EXISTS Students ;
5DROP TABLE IF EXISTS Books ;
6DROP TABLE IF EXISTS Transactions ;
7
8
9create table Students (SID int PRIMARY KEY NOT NULL, SName text, Class text,BirthDate date, Gender text, points int);
10create table Books (BookID int PRIMARY KEY NOT NULL, BookTitle text, Author text, pageCount int);
11create table Transactions (SID int NOT NULL, BookID int NOT NULL,TransactionType text, TDate date);
12
13insert into Books values (1, "The C Programming Language", "Brian W. Kernighan",200);
14insert into Books values (2, "Pro Git", "Scott Chacon",300);
15insert into Books values (3, "Planning Extreme Programming", " Kent Beck",500);
16insert into Books values (4, "The Past Present and Future of JavaScript", "Axel Rauschmayer ",350);
17insert into Books values (5, "Scratch 2.0 Programming", "Denis Golikov",218);
18
19
20insert into Students values (1, "Matt Smith",'11A','2000-02-20' , "male",100);
21insert into Students values (2, "James Bruce",'12A', '1992-10-17', "male",99);
22insert into Students values (3, " Roger Peng",'11A', '1991-09-04', "male",112);
23insert into Students values (4, "Angela Randall",'11A', '2000-02-20', "female",102);
24insert into Students values (5, "Shai Almog",'11A', '1970-05-07' , "female",150);
25insert into Students values (6, "Jamil Soucar",'10A', '1999-06-10', "male",80);
26insert into Students values (7, "Drew Neil",'11A', '1991-02-17', "male",100);
27
28insert into Transactions values ( 2, "1" , "borrow" , '2019-08-08' );
29insert into Transactions values ( 2, "1" , "return" , '2019-09-09' );
30insert into Transactions values ( 2, "1" , "borrow" , '2019-10-10' );
31insert into Transactions values ( 2, "1" , "return" , '2019-11-11' );
32insert into Transactions values ( 2, "3" , "return" , '2019-02-02' );
33insert into Transactions values ( 2, "4" , "borrow" , '2019-12-12' );
34insert into Transactions values ( 2, "6" , "return" , '2017-01-01' );
35insert into Transactions values ( 2, 2, "return" , '2015-05-06');
36insert into Transactions values ( 4, 5, "borrow" , '2016-01-01' );
37insert into Transactions values ( 4, 3, "borrow" , '2016-01-01' );
38insert into Transactions values ( 4, 3, "borrow" , '2016-01-01' );
39insert into Transactions values ( 5, 3, "borrow" , '2017-01-01' );
40insert into Transactions values ( 5, 6, "borrow" , '2017-01-01' );
41insert into Transactions values ( 5, 6, "return" , '2017-01-01' );
42insert into Transactions values ( 5, 5, "return" , '2019-01-01' );