-
Notifications
You must be signed in to change notification settings - Fork 0
/
restaurantdb.txt
310 lines (259 loc) · 10.8 KB
/
restaurantdb.txt
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
drop database if exists restaurantDB;
create database restaurantDB;
use restaurantDB;
create table restaurant (
restaurantName varchar(50) primary key not null,
street varchar(50) not null,
city varchar(50) not null,
pc char(6) not null,
websiteUrl varchar(100)
);
create table foodItems (
itemName varchar(100) primary key not null,
price decimal(5,2) not null
);
create table employee (
id char(9) primary key not null,
firstName varchar(50),
lastName varchar(50),
email varchar(100),
restaurantName varchar(50) not null,
foreign key (restaurantName) references restaurant(restaurantName) on delete cascade
);
create table chef (
id char(9) primary key not null,
foreign key (id) references employee(id) on delete cascade
);
create table chefCred (
chefID char(9) not null,
cred varchar(100) not null,
primary key(chefID, cred),
foreign key(chefID) references chef(id) on delete cascade
);
create table serverEmployee (
id char(9) primary key not null,
foreign key (id) references employee(id) on delete cascade
);
create table delivery (
id char(9) primary key not null,
foreign key (id) references employee(id) on delete cascade
);
create table managementEmployee (
id char(9) primary key not null,
foreign key (id) references employee(id) on delete cascade
);
create table shift (
endTime time,
startTime time,
shiftDay varchar(15) not null,
employeeID char(9) not null,
primary key(employeeID, shiftDay),
foreign key (employeeID) references employee(id) on delete cascade
);
create table customer (
email varchar(100) primary key not null,
phoneNum char(10),
street varchar(50) not null,
city varchar(50) not null,
pc char(6) not null,
firstName varchar(50),
lastName varchar(50)
);
create table payment(
paymentDate date not null,
paymentAmount decimal(5,2),
customerEmail varchar(100) not null,
creditAmnt decimal(5,2),
primary key(paymentDate, customerEmail),
foreign key (customerEmail) references customer(email) on delete cascade
);
create table customerOrder (
orderId char(5) primary key not null,
customerEmail varchar(100) not null,
totalPrice decimal(7,2) not null,
tip decimal(5,2),
restaurantName varchar(50) not null,
deliveryId char(9) not null,
orderTime time,
timeDelivered time,
orderDate date,
foreign key (customerEmail) references customer(email) on delete cascade,
foreign key (deliveryId) references delivery(id) on delete cascade,
foreign key (restaurantName) references restaurant(restaurantName) on delete cascade
);
create table orderContains(
orderId char(5) not null,
itemName varchar(50) not null,
primary key(orderId, itemName),
foreign key (orderId) references customerOrder(orderId) on delete cascade,
foreign key (itemName) references foodItems(itemName) on delete cascade
);
create table foodOffered (
restaurantName varchar(50) not null,
itemName varchar(50) not null,
primary key(restaurantName, itemName),
foreign key (restaurantName) references restaurant(restaurantName) on delete cascade,
foreign key (itemName) references foodItems(itemName) on delete cascade
);
create table isRelated (
customerEmail varchar(100) not null,
employeeID char(9) not null,
relationshipType varchar(50),
primary key(customerEmail, employeeID),
foreign key (employeeID) references employee(id) on delete cascade,
foreign key (customerEmail) references customer(email) on delete cascade
);
insert into restaurant values
('Miam', '40 Johnson St', 'Kingston', 'K7P8V8', 'https://miam.ca'),
('Kitchen Chicken','200 Princess St','Kingston','K7Z1A7','https://kitchenchicken.ca'),
('Bon Appetit','100 Earl St','Kingston','K7L1B2','https://bon-appetit.ca'),
('Sushi Sushi','440 Gore St','Kingston','K8L1K0','https://sushi-sushi.ca');
insert into foodItems values
('Tacos', '10.45'),
('Pasta Dish', '15.45'),
('Eggs Benedict', '18.45'),
('Chicken Burger', '9.45'),
('Fish and Chips', '19.00'),
('Sushi Platter', '20.45');
insert into employee values
('000000001','John','August','[email protected]', 'Miam'),
('000000002','Olivia','Kelsey','[email protected]', 'Miam'),
('000000003','Antoine','Williams','[email protected]', 'Miam'),
('000000004','Georgia','Smith','[email protected]', 'Miam'),
('000000005','Shirley','Acosta','[email protected]', 'Kitchen Chicken'),
('000000006','Ted','Logan','[email protected]', 'Miam'),
('000000007','Marie','Williems','[email protected]', 'Bon Appetit'),
('000000008','Neil','Lee','[email protected]', 'Sushi Sushi'),
('000000009','Matthew','Curry','[email protected]', 'Kitchen Chicken'),
('000000010','Ryan','Landry','[email protected]', 'Miam'),
('000000011','Cassie','Stevens','[email protected]', 'Bon Appetit'),
('000000012','Elle','Cortez','[email protected]', 'Sushi Sushi'),
('000000013','Lilian','Morse','[email protected]', 'Kitchen Chicken'),
('000000014','Julie','Chase','[email protected]', 'Kitchen Chicken'),
('000000015','Keon','Hardy','[email protected]', 'Kitchen Chicken'),
('000000016','Nicolas','Robin','[email protected]', 'Kitchen Chicken'),
('000000017','Leila','Petit','[email protected]', 'Bon Appetit'),
('000000018','Terrence','Chopin','[email protected]', 'Bon Appetit'),
('000000019','Keanu','Oliver','[email protected]', 'Bon Appetit'),
('000000020','Katie','Douglas','[email protected]', 'Sushi Sushi'),
('000000021','Freddy','Knox','[email protected]', 'Sushi Sushi'),
('000000022','Serena','Zamora','[email protected]', 'Sushi Sushi'),
('000000023','Aaron','Ramirez','[email protected]', 'Sushi Sushi'),
('000000024','Natalie','Roth','[email protected]', 'Bon Appetit');
insert into chef values
('000000001'),
('000000005'),
('000000009'),
('000000013'),
('000000017'),
('000000021');
insert into chefCred values
('000000001', 'Certified Foodservice Professional'),
('000000005', 'Certified Master Chef'),
('000000009', 'Certified Working Pastry Chef'),
('000000013', 'Master Certified Food Executive'),
('000000017', 'Master Certified Food Executive'),
('000000017', 'Certified Culinary Educator'),
('000000021', 'Certified Chef de Cuisine');
insert into serverEmployee values
('000000002'),
('000000006'),
('000000010'),
('000000014'),
('000000018'),
('000000022');
insert into managementEmployee values
('000000002'),
('000000007'),
('000000011'),
('000000015'),
('000000019'),
('000000023');
insert into delivery values
('000000004'),
('000000008'),
('000000012'),
('000000016'),
('000000020'),
('000000024');
insert into shift values
('20:00', '12:00', 'Tuesday','000000001'),
('20:00', '12:00', 'Friday','000000001'),
('20:00', '12:00', 'Wednesday','000000002'),
('20:00', '12:00', 'Thursday','000000002'),
('20:00', '12:00', 'Thursday','000000003'),
('20:00', '12:00', 'Monday','000000004'),
('15:30', '9:00', 'Friday','000000005'),
('15:30', '9:00', 'Friday','000000006'),
('15:30', '9:00', 'Friday','000000007'),
('15:30', '9:00', 'Friday','000000008'),
('16:00', '10:00', 'Tuesday','000000009'),
('16:00', '10:00', 'Saturday','000000010'),
('16:00', '10:00', 'Saturday','000000011'),
('16:00', '10:00', 'Saturday','000000012'),
('16:00', '9:00', 'Tuesday','000000013'),
('16:00', '9:00', 'Tuesday','000000014'),
('16:00', '9:00', 'Tuesday','000000015'),
('16:00', '9:00', 'Tuesday','000000016'),
('16:00', '11:00', 'Wednesday','000000017'),
('16:00', '11:00', 'Wednesday','000000018'),
('16:00', '11:00', 'Wednesday','000000019'),
('16:00', '11:00', 'Wednesday','000000020'),
('20:00', '12:30', 'Thursday','000000021'),
('20:00', '12:30', 'Thursday','000000022'),
('20:00', '12:30', 'Thursday','000000023'),
('20:00', '12:30', 'Thursday','000000024'),
('20:00', '12:30', 'Monday','000000024'),
('20:00', '12:30', 'Tuesday','000000024'),
('20:00', '12:30', 'Wednesday','000000024');
insert into customer values
('[email protected]', '6137779999', '100 Bagot St', 'Kingston', 'K9L2F0', 'Sarah','Roth'),
('[email protected]', '6134448888', '65 Princess St', 'Kingston', 'K7L2F6', 'Kyle','Williams'),
('[email protected]', '6133338888', '80 Earl St', 'Kingston', 'K7L2G6', 'Alex','Oliver'),
('[email protected]', '6477779999', '300 Princess St', 'Kingston', 'K9L7J6', 'Ethan','Hardy'),
('[email protected]', '6138088088', '650 Earl St', 'Kingston', 'K8L9P7', 'Mario','Stevens'),
('[email protected]', '6472225565', '600 Johnson St', 'Kingston', 'K9L9O1', 'Olivia','Curry');
insert into payment values
('2023-01-31', '13.58', '[email protected]', '00.00'),
('2023-01-31', '20.08', '[email protected]', '13.58'),
('2023-01-31', '23.98', '[email protected]', '10.00'),
('2023-01-31', '10.68', '[email protected]', '00.00'),
('2023-01-31', '24.69', '[email protected]', '3.58'),
('2023-01-31', '26.57', '[email protected]', '1.58'),
('2023-02-01', '26.57', '[email protected]', '1.58'),
('2023-02-02', '26.57', '[email protected]', '1.58'),
('2023-02-02', '24.69', '[email protected]', '1.58');
insert into customerOrder values
('00001', '[email protected]', '13.58', '2.03','Miam','000000004','14:30', '15:00', '2023-01-30'),
('00002', '[email protected]', '20.08', '3.01','Bon Appetit','000000008','12:20','12:58', '2023-01-30'),
('00003', '[email protected]', '23.98', '3.59' ,'Miam','000000012','11:08','11:50', '2023-01-31'),
('00004', '[email protected]', '10.68', '1.60','Kitchen Chicken','000000016','10:30','11:02', '2023-01-31'),
('00005', '[email protected]', '24.69', '3.70','Bon Appetit','000000020','12:45','13:30', '2023-01-31'),
('00006', '[email protected]', '26.57', '3.98','Sushi Sushi','000000024','17:30','18:06', '2023-01-30'),
('00007', '[email protected]', '26.57', '3.98','Sushi Sushi','000000024','17:30','18:06', '2023-02-01'),
('00008', '[email protected]', '24.69', '3.98','Bon Appetit','000000024','17:30','18:06', '2023-02-02'),
('00009', '[email protected]', '20.90', '9.98','Bon Appetit','000000004','18:30','19:06', '2023-02-02');
insert into orderContains values
('00001','Tacos'),
('00002','Pasta Dish'),
('00003','Eggs Benedict'),
('00004','Chicken Burger'),
('00005','Fish and Chips'),
('00006','Sushi Platter'),
('00007','Sushi Platter'),
('00008','Fish and Chips'),
('00009', 'Pasta Dish');
insert into foodOffered values
('Miam','Tacos'),
('Bon Appetit','Pasta Dish'),
('Miam','Eggs Benedict'),
('Kitchen Chicken','Chicken Burger'),
('Bon Appetit','Fish and Chips'),
('Sushi Sushi','Sushi Platter');
insert into isRelated values
('[email protected]', '000000024', 'Child/Parent'),
('[email protected]', '000000019', 'Siblings'),
('[email protected]', '000000003', 'Siblings'),
('[email protected]', '000000015', 'Child/Parent'),
('[email protected]', '000000011', 'Cousins'),
('[email protected]', '000000009', 'Cousins');