-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchips.sql
More file actions
executable file
·43 lines (36 loc) · 869 Bytes
/
chips.sql
File metadata and controls
executable file
·43 lines (36 loc) · 869 Bytes
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
CREATE TABLE chips (
id INTEGER PRIMARY KEY,
name VARCHAR(255) NOT NULL,
eater_id INTEGER,
FOREIGN KEY(eater_id) REFERENCES human(id)
);
CREATE TABLE eaters (
id INTEGER PRIMARY KEY,
fname VARCHAR(255) NOT NULL,
lname VARCHAR(255) NOT NULL,
factory_id INTEGER,
FOREIGN KEY(factory_id) REFERENCES human(id)
);
CREATE TABLE factories (
id INTEGER PRIMARY KEY,
address VARCHAR(255) NOT NULL
);
INSERT INTO
factories (id, address)
VALUES
(1, "1st and Fattest"), (2, "Where the sidewalk ends");
INSERT INTO
eaters (id, fname, lname, factory_id)
VALUES
(1, "Big", "Mouth", 1),
(2, "Little", "Tummy", 1),
(3, "About", "ToEat", 2),
(4, "CouldEat", "ACow", NULL);
INSERT INTO
chips (id, name, eater_id)
VALUES
(1, "Little Chip", 1),
(2, "Big Chip", 2),
(3, "Monstah Chip", 3),
(4, "Sunny Chip", 3),
(5, "Sour Chip", NULL);