RelationalDesign: polnenje_v1.sql

File polnenje_v1.sql, 4.9 KB (added by 201171, 8 months ago)
Line 
1truncate table user_table restart identity cascade;
2truncate table administrator restart identity cascade;
3truncate table delivery_man restart identity cascade;
4truncate table service_man restart identity cascade;
5truncate table customer restart identity cascade;
6truncate table warehouseman restart identity cascade;
7truncate table warehouse restart identity cascade;
8truncate table vehicle restart identity cascade;
9truncate table delivery restart identity cascade;
10truncate table review restart identity cascade;
11truncate table order_table restart identity cascade;
12truncate table manufacturer restart identity cascade;
13truncate table category restart identity cascade;
14truncate table subcategory restart identity cascade;
15truncate table product restart identity cascade;
16truncate table order_table_contains_product restart identity cascade;
17truncate table product_is_in_category restart identity cascade;
18truncate table product_is_in_stock_in_warehouse restart identity cascade;
19truncate table vehicle_is_used_for_delivery restart identity cascade;
20
21
22
23insert into user_table (username,name_user,email,"password" ,phone_number) values
24('john_doe_85', 'John Doe', 'john.doe@gmail.com', 'pass123', '123-456-7890'),
25('jane_smith_92', 'Jane Smith', 'jane.smith@gmail.com', 'securepass', '987-654-3210'),
26('alice_j_78', 'Alice Johnson', 'alice.j@gmail.com', 'alicepass123', '555-123-4567'),
27('bob_m_89', 'Bob Miller', 'bob.m@gmail.com', 'mypass123', '789-123-4560'),
28('eva_d_93', 'Eva Davis', 'eva.d@gmail.com', 'evapass', '345-678-9012'),
29('chris_wilson_87', 'Chris Wilson', 'chris.w@gmail.com', 'wilsonpass', '567-890-1234'),
30('sophie_brown_90', 'Sophie Brown', 'sophie.b@gmail.com', 'sophiepass', '123-987-6543'),
31('daniel_white_88', 'Daniel White', 'daniel.w@gmail.com', 'danielpass', '890-234-5678'),
32('emily_taylor_91', 'Emily Taylor', 'emily.t@gmail.com', 'emilypass', '432-109-8765'),
33('michael_j_94', 'Michael Johnson', 'michael.j@gmail.com', 'mikepass', '876-543-2109'),
34('olivia_clark_89', 'Olivia Clark', 'olivia.c@gmail.com', 'oliviapass', '321-654-0987'),
35('matthew_h_92', 'Matthew Harris', 'matthew.h@gmail.com', 'mattpass', '654-987-0123'),
36('laura_adams_86', 'Laura Adams', 'laura.a@gmail.com', 'laurapass', '789-234-5670'),
37('kevin_jones_95', 'Kevin Jones', 'kevin.j@gmail.com', 'kevinpass', '234-567-8901'),
38('megan_w_91', 'Megan Walker', 'megan.w@gmail.com', 'meganpass', '456-789-0123');
39
40insert into administrator (user_id) values
41(1), (2), (3);
42
43insert into delivery_man (user_id) values
44(4), (5), (6);
45
46insert into customer (user_id) values
47(7), (8), (9);
48
49insert into service_man (user_id) values
50(10), (11), (12);
51
52insert into warehouse (warehouse_location) values
53('123 Industrial Street, Skopje 1000, Macedonia'),
54('456 Commerce Avenue, Ohrid 6000, Macedonia'),
55('789 Summit Road, Bitola 7000, Macedonia');
56
57insert into warehouseman (user_id, warehouse_id) values
58(13,1),
59(14,2),
60(15,3);
61
62insert into vehicle (vehicle_model, vehicle_service, delivery_man_id) values
63('Ford Transit','01/01/2023',4),
64('Mercedes-Benz Sprinter','01/03/2023',5),
65('Chevrolet Express','01/06/2023',6);
66
67insert into order_table (order_status, order_date, customer_id) values
68('Processing', '01/29/2024', 7),
69('Shipped', '01/28/2024', 8),
70('Delivered', '01/27/2024', 9);
71
72insert into delivery (delivery_status, delivery_address, delivery_man_id, order_id) values
73('Pending', '123 Main Street, Cityville', 4, 1),
74('Shipped', '456 Park Avenue, Townsville', 5, 2),
75('Delivered', '789 Oak Lane, Villageton', 6, 3);
76
77insert into category (category_name) values
78('Processor'),
79('Graphics Card'),
80('Storage Drive');
81
82insert into subcategory (subcategory_name, category_id) values
83('Intel Core', 1),
84('NVIDIA GeForce', 2),
85('Samsung SSD', 3);
86
87insert into manufacturer (manufacturer_name) values
88('Intel'),
89('NVIDIA'),
90('Samsung');
91
92insert into product (product_name, product_description, product_price, product_warranty, product_image, manufacturer_id, service_man_id) values
93('Intel Core i7', 'Quad-core processor', 28000, 2, '/images/intel_core_i7.jpg', 1, 10),
94('NVIDIA GeForce RTX 3080', 'High-performance GPU', 42000, 3, '/images/nvidia_rtx_3080.jpg', 2, 11),
95('Samsung 2TB SSD', 'Fast storage drive', 12000, 5, '/images/samsung_2tb_ssd.jpg', 3, 12);
96
97insert into review (review_rating, review_description, customer_id, product_id) values
98(5, 'Impressive performance!', 7, 1),
99(4, 'Great GPU for gaming', 8, 2),
100(5, 'Fast and reliable SSD', 9, 3);
101
102insert into order_table_contains_product (order_id, product_id, quantity) values
103(1, 1, 4),
104(2, 2, 2),
105(3, 3, 3);
106
107insert into product_is_in_category (product_id, category_id) values
108(1, 1),
109(2, 2),
110(3, 3);
111
112insert into product_is_in_stock_in_warehouse (product_id, warehouse_id, quantity) values
113(1, 1, 10),
114(2, 2, 15),
115(3, 3, 8);
116
117insert into vehicle_is_used_for_delivery (vehicle_id, delivery_id) values
118(1, 1),
119(2, 2),
120(3, 3);