-
Notifications
You must be signed in to change notification settings - Fork 0
/
onlyplants.sql
558 lines (393 loc) · 18.6 KB
/
onlyplants.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
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
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
--
-- PostgreSQL database dump
--
-- Dumped from database version 12.4
-- Dumped by pg_dump version 12.4
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
--
-- Name: adminpack; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS adminpack WITH SCHEMA pg_catalog;
--
-- Name: EXTENSION adminpack; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION adminpack IS 'administrative functions for PostgreSQL';
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: admin; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.admin (
userid integer NOT NULL,
role character(50)
);
ALTER TABLE public.admin OWNER TO postgres;
--
-- Name: administrates; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.administrates (
domainname character(60) NOT NULL,
userid integer NOT NULL
);
ALTER TABLE public.administrates OWNER TO postgres;
--
-- Name: customer; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.customer (
userid integer NOT NULL,
address character(100),
email character(60),
dateofbirth character(10)
);
ALTER TABLE public.customer OWNER TO postgres;
--
-- Name: order_has; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.order_has (
productid integer NOT NULL,
orderid integer NOT NULL,
quantity integer
);
ALTER TABLE public.order_has OWNER TO postgres;
--
-- Name: orders; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.orders (
quantity integer,
deliverytype character(40),
orderid integer NOT NULL,
deliverytime double precision
);
ALTER TABLE public.orders OWNER TO postgres;
--
-- Name: payment; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.payment (
userid integer NOT NULL,
orderid integer NOT NULL,
paymenttype character(30),
paymentamount double precision
);
ALTER TABLE public.payment OWNER TO postgres;
--
-- Name: plants; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.plants (
age integer,
productid integer NOT NULL
);
ALTER TABLE public.plants OWNER TO postgres;
--
-- Name: pots; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.pots (
color character(20),
productid integer NOT NULL
);
ALTER TABLE public.pots OWNER TO postgres;
--
-- Name: products; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.products (
quantity integer,
productid integer NOT NULL,
size character(10),
type character(15),
price double precision,
image character(100),
name character(70)
);
ALTER TABLE public.products OWNER TO postgres;
--
-- Name: seeds; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.seeds (
count integer,
productid integer NOT NULL
);
ALTER TABLE public.seeds OWNER TO postgres;
--
-- Name: users; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.users (
userid integer NOT NULL,
firstname character(50),
lastname character(50),
login character(50),
password character(20)
);
ALTER TABLE public.users OWNER TO postgres;
--
-- Name: website; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.website (
domainname character(60) NOT NULL,
websitename character(60)
);
ALTER TABLE public.website OWNER TO postgres;
--
-- Data for Name: admin; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.admin (userid, role) FROM stdin;
777 HeadAdmin
791 Developer
751 Manager
\.
--
-- Data for Name: administrates; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.administrates (domainname, userid) FROM stdin;
https://onlyplants.com 777
https://onlyplants.com 791
https://onlyplants.com 751
\.
--
-- Data for Name: customer; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.customer (userid, address, email, dateofbirth) FROM stdin;
1 123 W Main St, Phoenix, AZ 82341 [email protected] 01/01/1999
2 134 E Main St, Phoenix, AZ 82341 [email protected] 08/14/1999
3 124 W Main Rd, Phoenix, AZ 82341 [email protected] 02/02/1999
\.
--
-- Data for Name: order_has; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.order_has (productid, orderid, quantity) FROM stdin;
1 1 5
2 2 5
100 3 5
1 1010 100
2 1010 1900
100 1010 2900
\.
--
-- Data for Name: orders; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.orders (quantity, deliverytype, orderid, deliverytime) FROM stdin;
5 FedEx 1 12.15
10 FedEx 2 1.15
10 FedEx 3 1.15
200 usps 1010 3
\.
--
-- Data for Name: payment; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.payment (userid, orderid, paymenttype, paymentamount) FROM stdin;
1 1 VISA 9.95
2 2 VISA 19.9
3 3 VISA 39.9
1 1010 VISA 300.09
\.
--
-- Data for Name: plants; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.plants (age, productid) FROM stdin;
25 100
4 101
2 102
2 103
5 104
1 105
1 106
3 107
\.
--
-- Data for Name: pots; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.pots (color, productid) FROM stdin;
red 200
black 201
white 202
sky blue 203
baby pink 204
aubergine 205
clay 206
black glossy 207
\.
--
-- Data for Name: products; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.products (quantity, productid, size, type, price, image, name) FROM stdin;
25 1 small seed 1.99 dandelion-seed-416x278.jpg dandelion_seed
75 3 small seed 1.99 zinnia-seed-416x416.jpg zinnia_seed
25 4 small seed 2.99 dahlia-seed-416x416.jpg dahlia_seed
25 5 small seed 2.99 petunia-seed-416x416.jpg petunia_seed
100 6 small seed 3.99 pansy-seed-416x312.jpg pansy_seed
25 7 small seed 1.99 calendula-seed-416x416.jpg calendula_seed
75 8 small seed 1.99 cornflower-seed-416x312.jpg cornflower_seed
25 100 small plant 12.99 small-monstera-1000x1000.jpg small_monstera
4 101 large plant 0.99 large-fiddle-leaf-2048x2048.jpg large_fiddle_leaf
2 102 small plant 14.99 small-spider-plant-416x416.jpg small_spider_plant
2 103 large plant 14.99 large-aloe-vera-416x501.jpg large_aloe_vera
5 104 small plant 19.99 small-peace-lilly-416x541.jpg small_peace_lilly
1 105 large plant 14.99 large-snake-plant-416x416.jpg large_snake_plant
1 106 small plant 9.99 small-bromeliad-416x416.jpg small_bromeliad
3 107 small plant 9.99 small-orchid-416x416.jpg small_orchid
25 200 small pot 3.99 small-red-pot-416x555.jpg small_red_pot
5 201 large pot 9.99 large-black-pot-416x300.jpg large_black_pot
5 202 large pot 9.99 large-white-pot-416x416.jpg large_white_pot
5 203 large pot 9.99 large-sky-blue-pot-416x517.jpg large_sky blue_pot
5 204 large pot 9.99 large-baby-pink-pot-416x624.jpg large_baby_pink_pot
5 205 small pot 3.99 small-aubergine-pot-416x416.jpg small_aubergine_pot
5 206 small pot 3.99 small-clay-pot-416x400.jpg small_clay_pot
5 207 small pot 3.99 small-black-glossy-pot-416x416.jpg small_black_glossy_pot
25 2 small seed 1.99 sunflower-seed-416x520 sunflower_seed
\.
--
-- Data for Name: seeds; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.seeds (count, productid) FROM stdin;
25 1
25 2
75 3
25 4
25 5
100 6
25 7
75 8
\.
--
-- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.users (userid, firstname, lastname, login, password) FROM stdin;
1 Jill Kapchan jillkapchan1 Password123
2 Brandon Nguyen brandonnguyen1 Password123
3 Crystal Nguyen crystalnguyen1 Password123
4 Briana Oliver brianaoliver1 Password124
777 Bob Ross bobross1 Admin123
791 Tim Otee timotee1 Admin123
751 Ava Lanche avalanche1 Admin123
\.
--
-- Data for Name: website; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.website (domainname, websitename) FROM stdin;
https://onlyplants.com onlyplants
\.
--
-- Name: admin admin_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.admin
ADD CONSTRAINT admin_pkey PRIMARY KEY (userid);
--
-- Name: administrates administrates_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.administrates
ADD CONSTRAINT administrates_pkey PRIMARY KEY (domainname, userid);
--
-- Name: customer customer_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.customer
ADD CONSTRAINT customer_pkey PRIMARY KEY (userid);
--
-- Name: order_has order_has_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.order_has
ADD CONSTRAINT order_has_pkey PRIMARY KEY (productid, orderid);
--
-- Name: orders orders_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.orders
ADD CONSTRAINT orders_pkey PRIMARY KEY (orderid);
--
-- Name: payment payment_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.payment
ADD CONSTRAINT payment_pkey PRIMARY KEY (userid, orderid);
--
-- Name: plants plant_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.plants
ADD CONSTRAINT plant_pkey PRIMARY KEY (productid);
--
-- Name: pots pots_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.pots
ADD CONSTRAINT pots_pkey PRIMARY KEY (productid);
--
-- Name: products product_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.products
ADD CONSTRAINT product_pkey PRIMARY KEY (productid);
--
-- Name: seeds seed_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.seeds
ADD CONSTRAINT seed_pkey PRIMARY KEY (productid);
--
-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_pkey PRIMARY KEY (userid);
--
-- Name: website website_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.website
ADD CONSTRAINT website_pkey PRIMARY KEY (domainname);
--
-- Name: admin admin_userid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.admin
ADD CONSTRAINT admin_userid_fkey FOREIGN KEY (userid) REFERENCES public.users(userid) ON DELETE CASCADE;
--
-- Name: administrates administrates_domainname_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.administrates
ADD CONSTRAINT administrates_domainname_fkey FOREIGN KEY (domainname) REFERENCES public.website(domainname);
--
-- Name: administrates administrates_userid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.administrates
ADD CONSTRAINT administrates_userid_fkey FOREIGN KEY (userid) REFERENCES public.users(userid);
--
-- Name: customer customer_userid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.customer
ADD CONSTRAINT customer_userid_fkey FOREIGN KEY (userid) REFERENCES public.users(userid) ON DELETE CASCADE;
--
-- Name: order_has order_has_orderid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.order_has
ADD CONSTRAINT order_has_orderid_fkey FOREIGN KEY (orderid) REFERENCES public.orders(orderid) ON DELETE CASCADE;
--
-- Name: order_has order_has_productid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.order_has
ADD CONSTRAINT order_has_productid_fkey FOREIGN KEY (productid) REFERENCES public.products(productid);
--
-- Name: payment payment_orderid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.payment
ADD CONSTRAINT payment_orderid_fkey FOREIGN KEY (orderid) REFERENCES public.orders(orderid) ON DELETE CASCADE;
--
-- Name: payment payment_userid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.payment
ADD CONSTRAINT payment_userid_fkey FOREIGN KEY (userid) REFERENCES public.customer(userid) ON DELETE CASCADE;
--
-- Name: plants plant_productid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.plants
ADD CONSTRAINT plant_productid_fkey FOREIGN KEY (productid) REFERENCES public.products(productid) ON DELETE CASCADE;
--
-- Name: pots pots_productid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.pots
ADD CONSTRAINT pots_productid_fkey FOREIGN KEY (productid) REFERENCES public.products(productid) ON DELETE CASCADE;
--
-- Name: seeds seed_productid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.seeds
ADD CONSTRAINT seed_productid_fkey FOREIGN KEY (productid) REFERENCES public.products(productid) ON DELETE CASCADE;
--
-- PostgreSQL database dump complete
--