-
Notifications
You must be signed in to change notification settings - Fork 0
/
tables.sql
52 lines (48 loc) · 1.24 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
------------------------------------------------------------------------
--Table Creation (SQLite)
------------------------------------------------------------------------
CREATE TABLE "categories" (
"category_name" TEXT,
"id" INTEGER,
PRIMARY KEY("id")
);
CREATE TABLE "menu_items" (
"item_name" TEXT,
"id" INTEGER,
PRIMARY KEY("item_name")
);
CREATE TABLE "restaurants" (
"id" INTEGER,
"name" TEXT,
PRIMARY KEY("id")
);
CREATE TABLE "nutrition" (
"restaurant_id" INTEGER,
"category_id" INTEGER,
"item_id" INTEGER UNIQUE,
"serving_size_oz" INTEGER,
"calories" INTEGER,
"calories_from_fat" INTEGER,
"total_fat_g" INTEGER,
"total_fat_%_dv" INTEGER,
"saturated_fat_g" INTEGER,
"saturated_fat_%_dv" INTEGER,
"trans_fat_g" INTEGER,
"cholesterol_mg" INTEGER,
"cholesterol_%_dv" INTEGER,
"sodium_mg" INTEGER,
"sodium_%_dv" INTEGER,
"carbohydrates_g" INTEGER,
"carbohydrates_%_dv" INTEGER,
"dietary_fiber_g" INTEGER,
"dietary_fiber_% _dv" INTEGER,
"sugars_g" INTEGER,
"protein_g" INTEGER,
"vitamin_a_%_dv" INTEGER,
"vitamin_c_%_dv" INTEGER,
"calcium_%_dv" INTEGER,
"iron_%_dv" INTEGER,
PRIMARY KEY("item_id"),
FOREIGN KEY("category_id") REFERENCES "categories"("id"),
FOREIGN KEY("restaurant_id") REFERENCES "restaurants"("id")
);