-
Notifications
You must be signed in to change notification settings - Fork 0
/
herbs.sql
111 lines (96 loc) · 4.86 KB
/
herbs.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
START TRANSACTION;
-- DROPS TABLES
DROP TABLE IF EXISTS HERB CASCADE;
DROP TABLE IF EXISTS SPICE CASCADE;
DROP TABLE IF EXISTS RATIO CASCADE;
DROP TABLE IF EXISTS CUISINE CASCADE;
DROP TABLE IF EXISTS PROTEINS CASCADE;
DROP TABLE IF EXISTS PRODUCE CASCADE;
-- TABLE OF RATIO OF FRESH AND DRY
CREATE TABLE RATIO (
RATIO_ID SERIAL PRIMARY KEY,
PART_FRESH DOUBLE PRECISION NOT NULL,
PART_DRY DOUBLE PRECISION NOT NULL
);
-- CREATES TABLES
CREATE TABLE HERB(
HERB_ID SERIAL PRIMARY KEY,
NAME VARCHAR (50) NOT NULL,
FLAVOR_DESCRIPTION VARCHAR (64),
RATIO_ID INT NOT NULL,
FOREIGN KEY (RATIO_ID) REFERENCES RATIO(RATIO_ID)
);
CREATE TABLE SPICE(
SPICE_ID SERIAL PRIMARY KEY,
NAME VARCHAR(64) NOT NULL,
FLAVOR_DESCRIPTION VARCHAR(50),
PART VARCHAR(64),
RATIO_ID INT NOT NULL,
FOREIGN KEY (RATIO_ID) REFERENCES RATIO(RATIO_ID)
);
CREATE TABLE JUICE (
JUICE_ID SERIAL PRIMARY KEY,
NAME VARCHAR(64) NOT NULL,
FLAVOR_DESCRIPTION VARCHAR(50),
RATIO_ID INT NOT NULL,
FOREIGN KEY (RATIO_ID) REFERENCES RATIO(RATIO_ID)
);
-- TABLE CONNECTING HERBS TO CUISINE
-- TABLE CONNECTING HERBS TO PROTIENS
-- TABLE CONNECTING HERBS TO PRODUCE
-- POPULATE TABLES
INSERT INTO RATIO(PART_FRESH, PART_DRY) VALUES
(9.0, 1.0),
(3.0, 1.0),
(2.0, 1.0),
(1.0, 1.0),
(1.0, 2.0),
(1.0, 9.0)
;
INSERT INTO HERB(NAME, FLAVOR_DESCRIPTION, RATIO_ID) VALUES
('PARSLEY', 'Clean Bright', (SELECT RATIO_ID FROM RATIO WHERE PART_FRESH = 2.0)),
('BASIL', 'Sweet, sunny flavor versatile', (SELECT RATIO_ID FROM RATIO WHERE PART_FRESH = 2.0)),
('CHIVES', 'Delicate onion flavor, never overpowering', (SELECT RATIO_ID FROM RATIO WHERE PART_FRESH = 2.0)),
('CILANTRO', 'Fresh, aromatic, distinctive', (SELECT RATIO_ID FROM RATIO WHERE PART_FRESH = 3.0)),
('DILL', 'Pungent, tangy; dominate', (SELECT RATIO_ID FROM RATIO WHERE PART_FRESH = 3.0)),
('MARJORAM', 'Oregano like but sweeter', (SELECT RATIO_ID FROM RATIO WHERE PART_FRESH = 3.0)),
('MINT', 'Strong; sweet', (SELECT RATIO_ID FROM RATIO WHERE PART_FRESH = 2.0)),
('OREGANO', 'Earthy', (SELECT RATIO_ID FROM RATIO WHERE PART_FRESH = 3.0)),
('ROSEMARY', 'Fresh, piney, pungent; easily overpowers', (SELECT RATIO_ID FROM RATIO WHERE PART_FRESH = 3.0)),
('SAGE', 'Almost mint-like, slightly bitter; can overpower other herbs', (SELECT RATIO_ID FROM RATIO WHERE PART_FRESH = 2.0)),
('TARRAGON', 'Licorice, lemon flavor; strong', (SELECT RATIO_ID FROM RATIO WHERE PART_FRESH = 3.0)),
('GARLIC', 'Strong, warm bite, versatile', (SELECT RATIO_ID FROM RATIO WHERE PART_FRESH = 3.0)),
('THYME', 'Earthy, subtle, versatile', (SELECT RATIO_ID FROM RATIO WHERE PART_FRESH = 3.0)),
('CHERVIL', 'Clean Bright, French garden parsley', (SELECT RATIO_ID FROM RATIO WHERE PART_FRESH = 3.0)),
('STAR ANISE', 'Clean Bright, French garden parsley', (SELECT RATIO_ID FROM RATIO WHERE PART_FRESH = 2.0)),
('BAY LEAVES', 'Pungent, mint like', (SELECT RATIO_ID FROM RATIO WHERE PART_DRY = 2.0)),
('ONION', 'Sharp, bitey, versatile', (SELECT RATIO_ID FROM RATIO WHERE PART_FRESH = 1.0 AND PART_DRY = 1.0))
;
INSERT INTO SPICE(NAME, FLAVOR_DESCRIPTION, PART, RATIO_ID) VALUES
('Allspice', 'Similar to cloves and cinnamon combo, more complex', 'Berries', (SELECT RATIO_ID FROM RATIO WHERE PART_FRESH = 2.0)),
('Celery', 'Stronger then celery flavor', 'Seeds', (SELECT RATIO_ID FROM RATIO WHERE PART_FRESH = 2.0)),
('Chile', 'Spicy and hot with earthy tones', 'Pepper', (SELECT RATIO_ID FROM RATIO WHERE PART_FRESH = 2.0)),
('Cinnamon', 'Pungent, sweet, hot.', 'Bark', (SELECT RATIO_ID FROM RATIO WHERE PART_FRESH = 2.0)),
('Cloves', 'Aromatic, sweet', 'Berries', (SELECT RATIO_ID FROM RATIO WHERE PART_FRESH = 2.0)),
('Cumin', 'Bold, distinctive; can overpower.', 'Seeds', (SELECT RATIO_ID FROM RATIO WHERE PART_FRESH = 2.0)),
('Fennel', 'Licorice-like', 'Seeds', (SELECT RATIO_ID FROM RATIO WHERE PART_FRESH = 2.0)),
('Ginger', 'Pungent, spicy.', 'Root', (SELECT RATIO_ID FROM RATIO WHERE PART_FRESH = 9.0)),
('Nutmeg', 'Sweet, spicy, fragrant.', 'Seeds', (SELECT RATIO_ID FROM RATIO WHERE PART_FRESH = 2.0)),
('Pepper', 'Similar to cloves and cinnamon combo, more complex', 'Berries', (SELECT RATIO_ID FROM RATIO WHERE PART_FRESH = 2.0)),
('Coriander', 'Earthy, peppery', 'Seeds', (SELECT RATIO_ID FROM RATIO WHERE PART_FRESH = 2.0)),
('Cardamom', 'Sweet', 'Seeds', (SELECT RATIO_ID FROM RATIO WHERE PART_FRESH = 2.0)),
('Turmeric', 'Peppery, Bitter', 'root', (SELECT RATIO_ID FROM RATIO WHERE PART_FRESH = 2.0)),
('Cayenne Pepper', 'Spicy', 'Berries', (SELECT RATIO_ID FROM RATIO WHERE PART_FRESH = 2.0))
;
INSERT INTO JUICE(NAME, FLAVOR_DESCRIPTION, RATIO_ID) VALUES
('LEMON', 'Lemony', (SELECT RATIO_ID FROM RATIO WHERE PART_DRY = 9.0))
;
SELECT SPICE_ID, NAME, FLAVOR_DESCRIPTION, PART_FRESH, PART_DRY
FROM SPICE
JOIN RATIO ON SPICE.RATIO_ID = RATIO.RATIO_ID
ORDER BY PART_FRESH, PART_DRY, NAME
SELECT HERB_ID, NAME, FLAVOR_DESCRIPTION, PART_FRESH, PART_DRY
FROM HERB
JOIN RATIO ON HERB.RATIO_ID = RATIO.RATIO_ID
ORDER BY PART_FRESH, PART_DRY, NAME
Rollback;