-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhw1.sql
49 lines (39 loc) · 1016 Bytes
/
hw1.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
CREATE TABLE Constructors
(
constructor varchar(20) not null,
country varchar(10),
engine varchar(10),
races_entered int,
height int,
width int,
PRIMARY KEY(constructor)
)
describe Constructors;
CREATE TABLE Drivers
(
name varchar(15) not null,
birthday date,
country varchar(10),
constructor varchar(20),
PRIMARY KEY(name),
FOREIGN KEY (constructor) REFERENCES Constructors);
)
describe Drivers;
CREATE TABLE Races
(
name varchar(30) not null,
date date,
area varchar(20),
PRIMARY KEY(name)
)
describe Races;
CREATE TABLE Results
(
race varchar(30) not null,
driver varchar(15) not null,
race_rank varchar(15),
PRIMARY KEY(race, driver),
FOREIGN KEY (race) REFERENCES Races,
FOREIGN KEY (driver) REFERENCES Drivers
)
describe Results;