-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathturtles.sql
46 lines (39 loc) · 895 Bytes
/
turtles.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
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 human(id)
);
CREATE TABLE turtles (
id INTEGER PRIMARY KEY,
name VARCHAR(255) NOT NULL,
owner_id INTEGER,
FOREIGN KEY(owner_id) REFERENCES human(id)
);
CREATE TABLE houses (
id INTEGER PRIMARY KEY,
address VARCHAR(255) NOT NULL
);
INSERT INTO
turtles (id, name, owner_id)
VALUES
(1, "Tyson", 1),
(2, "Rocco", 2),
(3, "Max", 2),
(4, "Hotdog", 3),
(5, "Goose", NULL);
INSERT INTO
humans (id, fname, lname, house_id)
VALUES
(1, "Frank", "Reynolds", 1),
(2, "Dennis", "Reynolds", 2),
(3, "Rickity", "Cricket", 3),
(4, "Charlie", "Day", 4);
INSERT INTO
houses (id, address)
VALUES
(1, "711 Maple Street"),
(2, "742 Evergreen Terrace"),
(3, "Paddy's Pub, PA"),
(4, "Paddy's Pub, PA");