You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-- creates the cjdate sample database in SQL for comparison with TutorialD
2
+
BEGIN;
3
+
CREATETABLEs (
4
+
"s#"varchar(2) primary key,
5
+
sname varchar(10) NOT NULL,
6
+
status intNOT NULL,
7
+
city varchar(10) NOT NULL
8
+
);
9
+
10
+
CREATETABLEp (
11
+
"p#"varchar(2) primary key,
12
+
pname varchar(10) NOT NULL,
13
+
color varchar(10) NOT NULL,
14
+
weight realNOT NULL,
15
+
city varchar(10) NOT NULL
16
+
);
17
+
18
+
CREATETABLEsp (
19
+
"s#"varchar(2) NOT NULLREFERENCES s("s#"),
20
+
"p#"varchar(2) NOT NULLREFERENCES p("p#"),
21
+
qty intNOT NULL,
22
+
PRIMARY KEY ("s#", "p#")
23
+
);
24
+
25
+
INSERT INTO s(city, "s#", sname, status) VALUES ('Athens','S5','Adams',30),('Paris','S3','Blake',30),('London','S1','Smith',20),('Paris','S2','Jones',10),('London','S4','Clark',20);
26
+
27
+
INSERT INTO p(city,color,"p#",pname,weight) VALUES ('London','Red','P6','Cog',19),('Oslo','Blue','P3','Screw',17),('London','Red','P4','Screw',14),('London','Red','P1','Nut',12),('Paris','Green','P2','Bolt',17),('Paris','Blue','P5','Cam',12);
28
+
29
+
INSERT INTO sp("p#",qty,"s#") VALUES ('P1',300,'S2'),('P1',300,'S1'),('P2',400,'S2'),('P2',200,'S4'),('P2',200,'S3'),('P2',200,'S1'),('P3',400,'S1'),('P4',200,'S1'),('P4',300,'S4'),('P5',400,'S4'),('P5',100,'S1'),('P6',100,'S1');
0 commit comments