stats170ab-2019: hoofersdb.sql

File hoofersdb.sql, 1.4 KB (added by Wail Yousef A Alkowaileet, 7 years ago)
Line 
1DROP TABLE IF EXISTS Boats;
2
3CREATE TABLE Boats (
4 bid integer NOT NULL,
5 bname varchar(45) DEFAULT NULL,
6 color varchar(15) DEFAULT NULL,
7 PRIMARY KEY (bid)
8);
9
10--
11-- Loading data for table Boats
12--
13
14INSERT INTO Boats VALUES (101,'Interlake','blue'),(102,'Interlake','red'),(103,'Clipper','green'),(104,'Marine','red');
15
16--
17-- Table structure for table Reserves
18--
19
20DROP TABLE IF EXISTS Reserves;
21
22CREATE TABLE Reserves (
23 sid integer DEFAULT NULL,
24 bid integer DEFAULT NULL,
25 date date DEFAULT NULL
26);
27
28--
29-- Loading data for table Reserves
30--
31
32
33INSERT INTO Reserves VALUES (22,101,'1998-10-10'),(22,102,'1998-10-10'),(22,103,'1998-10-08'),(22,104,'1998-10-07'),(31,102,'1998-11-10'),(31,103,'1998-11-06'),(31,104,'1998-11-12'),(64,101,'1998-09-05'),(64,102,'1998-09-08'),(74,103,'1998-09-08'),(NULL,103,'1998-09-09'),(1,NULL,'2001-01-11'),(1,NULL,'2002-02-02');
34
35--
36-- Table structure for table Sailors
37--
38
39DROP TABLE IF EXISTS Sailors;
40
41CREATE TABLE Sailors (
42 sid integer NOT NULL,
43 sname varchar(45) NOT NULL,
44 rating integer DEFAULT NULL,
45 age decimal(5,1) DEFAULT NULL,
46 PRIMARY KEY (sid)
47);
48
49--
50-- Loading data for table Sailors
51--
52
53INSERT INTO Sailors VALUES (22,'Dustin',7,45.0),(29,'Brutus',1,33.0),(31,'Lubber',8,55.5),(32,'Andy',8,25.5),(58,'Rusty',10,35.0),(64,'Horatio',7,35.0),(71,'Zorba',10,16.0),(74,'Horatio',9,35.0),(85,'Art',4,25.5),(95,'Bob',3,63.5),(101,'Joan',3,NULL),(107,'Johannes',NULL,35.0);
54
55