RelationalSchema: dml.sql

File dml.sql, 3.4 KB (added by 221128, 6 weeks ago)
Line 
1INSERT INTO users(id, email, password, phone_number, street, city) -- password1
2VALUES
3 (1, 'test@hotmail.com', '$2a$10$rliIgXfgZgT1ljzxf.3NjeF1hx63s30xKfUsKjeUYA8jL/GXA1Jsy', '070003005', 'Mladinska 3', 'Strumica'),
4 (2, 'test2@hotmail.com', '$2a$10$rliIgXfgZgT1ljzxf.3NjeF1hx63s30xKfUsKjeUYA8jL/GXA1Jsy', '070001002', 'Marsal Tito 10', 'Strumica'),
5 (3, 'test3@hotmail.com', '$2a$10$rliIgXfgZgT1ljzxf.3NjeF1hx63s30xKfUsKjeUYA8jL/GXA1Jsy', '070003003', 'Mladinska 5', 'Strumica'),
6 (4, 'test4@hotmail.com', '$2a$10$rliIgXfgZgT1ljzxf.3NjeF1hx63s30xKfUsKjeUYA8jL/GXA1Jsy', '070004004', 'Marsal Tito 11', 'Strumica'),
7 (5, 'test5@hotmail.com', '$2a$10$rliIgXfgZgT1ljzxf.3NjeF1hx63s30xKfUsKjeUYA8jL/GXA1Jsy', '070005005', 'Mladinska 12', 'Strumica');
8
9INSERT INTO employees(user_id, net_salary, gross_salary)
10VALUES
11 (1, 30000, 40000),
12 (3, 50000, 62000),
13 (4, 35000, 46000),
14 (5, 28000, 37000);
15
16INSERT INTO managers(employee_id)
17VALUES
18 (3);
19
20INSERT INTO staff_roles(id, name)
21VALUES
22 (1, 'Server'),
23 (2, 'Chef'),
24 (3, 'Bartender'),
25 (4, 'Hostess');
26
27INSERT INTO front_staff(employee_id, tip_percent, staff_role_id)
28VALUES
29 (1, .4, 1),
30 (5, 0.1, 4);
31
32INSERT INTO back_staff(employee_id, staff_role_id)
33VALUES
34 (4, 2);
35
36INSERT INTO customers(user_id)
37VALUES
38 (2);
39
40INSERT INTO shifts (id, date, start_time, end_time, manager_id)
41VALUES
42 (1, current_date, '09:00:00', '17:00:00', 3);
43
44INSERT INTO assignments(id, clock_in_time, clock_out_time, manager_id, employee_id, shift_id)
45VALUES
46 (1, NULL, NULL, 3, 1, 1);
47
48INSERT INTO tables(table_number, seat_capacity)
49VALUES
50 (1, 4),
51 (2, 8);
52
53INSERT INTO reservations(id, user_id, creation_timestamp, datetime, stay_length, number_of_people)
54VALUES
55 (1, 2, now(), now(), NULL, 4);
56
57INSERT INTO frontstaff_managed_reservations(id, reservation_id, front_staff_id, table_number)
58VALUES
59 (1, 1, 5, 1);
60
61INSERT INTO categories(id, name)
62VALUES
63 (1, 'Drinks'),
64 (2, 'Appetizers'),
65 (3, 'Entrees');
66
67INSERT INTO products(id, name, description, price, category_id, manage_inventory, tax_class)
68VALUES
69 (1, 'Coca Cola', 'A classic carbonated soft drink.', 100, 1, TRUE, 'A'),
70 (2, 'Pomfrit so sirenje', 'Crispy french fries topped with melted cheese.', 250, 2, FALSE, 'A');
71
72INSERT INTO inventories(product_id, quantity)
73VALUES
74 (1, 100);
75
76-- The 'employee_id' in orders table is now used to link orders to front staff.
77INSERT INTO orders(id, status, datetime, employee_id)
78VALUES
79 (1, 'PENDING', '2025-01-05 10:00:00', 1), -- Order placed by server with employee_id 1
80 (2, 'ACCEPTED', '2025-01-05 10:00:00', 1),
81 (3, 'CONFIRMED', '2025-01-05 11:00:00', NULL); -- Online order with no employee assigned initially
82
83INSERT INTO order_items (id, order_id, product_id, is_processed, quantity, price)
84SELECT 1, 1, 1, TRUE, 3, price FROM products WHERE id = 1
85UNION ALL
86SELECT 2, 1, 2, FALSE, 1, price FROM products WHERE id = 2
87UNION ALL
88SELECT 3, 3, 2, FALSE, 2, price FROM products WHERE id = 2
89UNION ALL
90SELECT 4, 3, 1, FALSE, 2, price FROM products WHERE id = 1;
91
92INSERT INTO tab_orders(order_id, table_number)
93VALUES
94 (1, 1);
95
96INSERT INTO online_orders(order_id, delivery_address, customer_id)
97VALUES
98 (3, 'Leninova 5', 2);
99
100INSERT INTO payments(id, order_id, amount, payment_type, tip_amount)
101VALUES
102 (1, 3, 700, 'cash', 10);