-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtables.sql
74 lines (63 loc) · 1.46 KB
/
tables.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
CREATE TABLE turtles (
id INTEGER PRIMARY KEY,
name VARCHAR(255) NOT NULL,
owner_id INTEGER,
FOREIGN KEY(owner_id) REFERENCES human(id)
);
CREATE TABLE humans (
id INTEGER PRIMARY KEY,
fname VARCHAR(255) NOT NULL,
lname VARCHAR(255) NOT NULL,
house_id INTEGER,
FOREIGN KEY(house_id) REFERENCES house(id)
);
CREATE TABLE houses (
id INTEGER PRIMARY KEY,
address VARCHAR(255) NOT NULL,
neighborhood_id INTEGER,
FOREIGN KEY(neighborhood_id) REFERENCES neighborhood(id)
);
CREATE TABLE neighborhoods (
id INTEGER PRIMARY KEY,
name VARCHAR(255) NOT NULL
);
INSERT INTO
neighborhoods (id, name)
VALUES
(1, "Bushwick"),
(2, "East Village"),
(3, "West Village"),
(4, "Harlem"),
(5, "SoHo");
INSERT INTO
houses (id, address, neighborhood_id)
VALUES
(1, "10000 Penn Ave", 5),
(2, "543 Main st.", 4),
(3, "600 Washington st.", 3),
(4, "6346 Neiman Way", 2),
(5, "600 Tristan Pl.", 1),
(6, "600 Cullary Rd.", 1),
(7, "600 Broadway Ave.", 5);
INSERT INTO
humans (id, fname, lname, house_id)
VALUES
(1, "Devin", "Starks", 1),
(2, "Dan", "Wilson", 1),
(3, "Tyler", "Cratcha", 2),
(4, "Conrad", "Reeves", 3),
(5, "Mike", "Stephenson", 4),
(6, "Marc", "Carroll", 4),
(7, "Gabe", "Kuzava", 7);
INSERT INTO
turtles (id, name, owner_id)
VALUES
(1, "Gulper", 1),
(2, "Earl", 2),
(3, "Tina", 3),
(4, "Tuna", 3),
(5, "Gina", 4),
(6, "Choco", 6),
(7, "Reed", 7),
(8, "Scooter", 5),
(9, "Stray turtle", NULL);