Logical and Physical Design – Database Creation: DML.sql

File DML.sql, 3.2 KB (added by 221531, 5 days ago)
Line 
1INSERT INTO app_user (user_id, first_name, last_name, email, password, phone)
2VALUES
3(1, 'Aysun', 'Suleymanturk', 'aysun@example.com', 'pass123', '5551112233'),
4(2, 'Ece', 'Mucaiti', 'ece@example.com', 'pass123', '5554446677'),
5(3, 'Esin', 'Suleymanturk', 'esin@example.com', 'pass123', '5558889999');
6
7INSERT INTO ADMINISTRATOR (user_id, authorized_from, authorized_till) VALUES
8(3, '2025-01-01', '2025-12-31');
9
10INSERT INTO address (address_id, city, street, postal_code)
11VALUES
12(1, 'Skopje', 'Maksim Gorki', '1000'),
13(2, 'Skopje', 'Gjorče Petrov', '1060');
14
15
16INSERT INTO category (category_id, name, description)
17VALUES
18(1, 'Pizza', 'All kinds of pizza'),
19(2, 'Burgers', 'Delicious burgers'),
20(3, 'Drinks', 'Beverages');
21
22
23INSERT INTO item (item_id, image_url, name, price, description)
24VALUES
25(1, 'pizza.jpg', 'Margherita Pizza', 80.00, 'Classic cheese pizza'),
26(2, 'burger.jpg', 'Cheeseburger', 60.00, 'Juicy cheeseburger'),
27(3, 'cola.jpg', 'Coca Cola', 20.00, 'Chilled soft drink');
28
29
30INSERT INTO ingredient (ingredient_id, name)
31VALUES
32(1, 'Cheese'),
33(2, 'Tomato'),
34(3, 'Beef'),
35(4, 'Lettuce');
36
37
38INSERT INTO delivery_firm (deliveryfirm_id, name)
39VALUES (1, 'FastDelivery');
40
41
42
43INSERT INTO restaurant (restaurant_id, name, website_url, opening_time, closing_time, email, phone_number, address_id)
44VALUES
45(1, 'Pizza Hut', 'www.pizzahut.com', '10:00', '23:00', 'info@pizzahut.com', '2121112233', 1),
46(2, 'Burger World', 'www.burgerworld.com', '11:00', '22:00', 'contact@burgerworld.com', '3124445566', 2);
47
48
49
50INSERT INTO customer (user_id) VALUES (1);
51INSERT INTO delivery_man (user_id) VALUES (2);
52INSERT INTO restaurant_owner (user_id) VALUES (3);
53
54
55
56INSERT INTO user_addresses (address_id, user_id) VALUES (1, 1);
57
58
59
60INSERT INTO restaurant_owners (user_id, restaurant_id) VALUES (3, 1);
61
62
63INSERT INTO item_category (category_id, item_id) VALUES
64(1, 1),
65(2, 2),
66(3, 3);
67
68
69
70INSERT INTO restaurant_category (category_id, restaurant_id) VALUES
71(1, 1),
72(2, 2);
73
74
75
76INSERT INTO earnings (earning_id, restaurant_id, date, amount, source)
77VALUES
78(1, 1, '2025-08-01', 2000.50, 'Orders'),
79(2, 2, '2025-08-02', 1500.00, 'Orders');
80
81
82
83INSERT INTO costs (cost_id, restaurant_id, date, amount, type)
84VALUES
85(1, 1, '2025-08-01', 500.00, 'Ingredients'),
86(2, 2, '2025-08-02', 300.00, 'Utilities');
87
88
89
90INSERT INTO item_ingredient (item_id, ingredient_id, quantity) VALUES
91(1, 1, '100g'),
92(1, 2, '50g'),
93(2, 3, '150g'),
94(2, 4, '30g');
95
96
97
98INSERT INTO delivery_assignment (deliveryfirm_id, user_id)
99VALUES
100(1, 2);
101
102
103INSERT INTO MENU (restaurant_id, name) VALUES
104(1, 'Pizza Hut Menu'),
105(2, 'Burger World Menu');
106
107
108INSERT INTO MENU_ITEM (menu_id, item_id) VALUES
109(1, 1),
110(2, 2),
111(2, 3);
112
113INSERT INTO SHOPPING_CART (user_id) VALUES
114(1),
115(2);
116
117
118INSERT INTO CART_ITEMS (cart_id, item_id, quantity) VALUES
119(1, 1, 2),
120(1, 3, 1),
121(2, 2, 1);
122
123
124INSERT INTO ORDERS (address_id, restaurant_id, deliveryman_id, user_id, order_status, total_amount) VALUES
125(1, 1, 2, 1, 'Pending', 180.00),
126(2, 2, 2, 1, 'Delivered', 80.00);
127
128
129INSERT INTO ORDER_ITEMS (order_id, item_id, quantity, total_price) VALUES
130(1, 1, 2, 160.00),
131(1, 3, 1, 20.00),
132(2, 2, 1, 60.00);