| | 1 | {{{#!sql |
| | 2 | -- CATEGORY |
| | 3 | INSERT INTO category (name, parent_category_id) VALUES |
| | 4 | ('Furniture', NULL), |
| | 5 | ('Home Decor', NULL), |
| | 6 | ('Gifts', NULL), |
| | 7 | ('Chairs', 1), |
| | 8 | ('Tables', 1), |
| | 9 | ('Wall Decor', 2), |
| | 10 | ('Textiles', 3), |
| | 11 | ('Crochet', 7), |
| | 12 | ('Beadwork', 7); |
| | 13 | |
| | 14 | -- PRODUCT |
| | 15 | INSERT INTO product (code, price, availability, weight, width_x_length_x_depth, aprox_production_time, description, cathegory_id) VALUES |
| | 16 | ('00100001', 700.00, 50, 2.50, '30x20x10', 10, 'Handmade wooden chair with oak wood', 4), |
| | 17 | ('00200001', 150.00, 10, 0.20, '20x20x15', 2, 'Heart crochet decoration', 8), |
| | 18 | ('00200002', 199.00, 100, 0.75, '40x40x1', 14, 'Decorative wall hanging made with beads', 9), |
| | 19 | ('00100002', 1200.00, 15, 15.00, '180x90x75', 21, 'Solid oak dining table', 5), |
| | 20 | ('00200003', 89.99, 25, 0.50, '60x30x2', 7, 'Macrame wall hanging', 6); |
| | 21 | |
| | 22 | -- IMAGE (multiple images per product allowed) |
| | 23 | INSERT INTO image (product_code, image) VALUES |
| | 24 | ('00100001', 'chair_front.jpg'), |
| | 25 | ('00100001', 'chair_side.jpg'), |
| | 26 | ('00100001', 'chair_detail.jpg'), |
| | 27 | ('00200001', 'crochet-heart-red.jpg'), |
| | 28 | ('00200001', 'crochet-heart-blue.jpg'), |
| | 29 | ('00200002', 'wall_hanging_pink.jpg'), |
| | 30 | ('00200002', 'wall_hanging_gold.jpg'), |
| | 31 | ('00100002', 'dining_table_oak.jpg'), |
| | 32 | ('00200003', 'macrame_wall_hanging.jpg'); |
| | 33 | |
| | 34 | -- COLOR |
| | 35 | INSERT INTO color (product_code, color) VALUES |
| | 36 | ('00100001', 'Brown'), |
| | 37 | ('00100001', 'Walnut'), |
| | 38 | ('00100001', 'Ebony'), |
| | 39 | ('00200001', 'Blue'), |
| | 40 | ('00200001', 'Red'), |
| | 41 | ('00200001', 'Yellow'), |
| | 42 | ('00200001', 'Green'), |
| | 43 | ('00200002', 'White and Pink'), |
| | 44 | ('00200002', 'Black and Gold'), |
| | 45 | ('00200002', 'Orange, Green and Purple'), |
| | 46 | ('00100002', 'Natural Oak'), |
| | 47 | ('00100002', 'Dark Stain'), |
| | 48 | ('00200003', 'Natural'), |
| | 49 | ('00200003', 'White'); |
| | 50 | |
| | 51 | -- STORE |
| | 52 | INSERT INTO store (store_id, name, date_of_founding, physical_address, store_email, rating) VALUES |
| | 53 | ('001', 'WoodCraft Skopje', '2015-03-12', 'st.Ilindenska 45, Skopje 1000, Macedonia', 'contact@woodcraft.mk', 4.6), |
| | 54 | ('002', 'Fox Crochets', '2023-06-01', 'st.Kej Makedonija 12, Ohrid 6000, Macedonia', 'ohrid@foxcrochets.mk', 4.8), |
| | 55 | ('003', 'Artisan Collective', '2020-01-15', 'st.Goce Delcev 78, Bitola 7000, Macedonia', 'info@artisancollective.mk', 4.5); |
| | 56 | |
| | 57 | -- PERSONAL |
| | 58 | INSERT INTO personal (ssn, first_name, last_name, email, password) VALUES |
| | 59 | ('1234567890123', 'Marko', 'Petrovski', 'marko@woodcraft.mk', 'Havr6njs09$hdgs'), |
| | 60 | ('9876543210987', 'Antonio', 'Trajkovski', 'antonio@woodcraft.mk', 'GKm78BHs&vJHA'), |
| | 61 | ('4567891234567', 'Sara', 'Vaneva', 's.vaneva@foxcrochets.mk', 'hY69Btvhs90'), |
| | 62 | ('7891234567890', 'Elena', 'Nikolovska', 'elena@artisancollective.mk', 'Pp45@kjsdD'), |
| | 63 | ('3216549870123', 'Dimitar', 'Risteski', 'dimitar@foxcrochets.mk', 'Ls92#hjsDf'); |
| | 64 | |
| | 65 | -- PERMISSIONS |
| | 66 | INSERT INTO permissions (personal_SSN, type, authorisation) VALUES |
| | 67 | ('1234567890123', 'BOSS', 'admin'), |
| | 68 | ('9876543210987', 'EMPLOYEE', '1234567890123'), |
| | 69 | ('4567891234567', 'BOSS', 'admin'), |
| | 70 | ('7891234567890', 'MANAGER', '3216549870123'), |
| | 71 | ('3216549870123', 'BOSS', 'admin'); |
| | 72 | |
| | 73 | -- BOSS |
| | 74 | INSERT INTO boss (boss_SSN) VALUES |
| | 75 | ('1234567890123'), |
| | 76 | ('4567891234567'), |
| | 77 | ('3216549870123'); |
| | 78 | |
| | 79 | -- EMPLOYEES |
| | 80 | INSERT INTO employees (employee_SSN, date_of_hire) VALUES |
| | 81 | ('9876543210987', '2019-09-01'), |
| | 82 | ('7891234567890', '2020-02-15'); |
| | 83 | |
| | 84 | -- CLIENT |
| | 85 | INSERT INTO client (client_id, first_name, last_name, email, password) VALUES |
| | 86 | (1001, 'Ivan', 'Stojanov', 'ivan@gmail.com', 'hkh689gvgsh%hd'), |
| | 87 | (1002, 'Marija', 'Kostova', 'marija@yahoo.com', 'PJdbbh334$djk-hs'), |
| | 88 | (1003, 'Antoneta', 'Mariovska', 'mariovskaantoneta@finki.ukim.mk', '*bxhc6cbsd3@xh'), |
| | 89 | (1004, 'Petar', 'Dimitrievski', 'petar.d@hotmail.com', 'Xh78$jsdK12'), |
| | 90 | (1006, 'Ana', 'Stojanova', 'ana.stojanova@gmail.com', 'An89#kjsdFg'); |
| | 91 | |
| | 92 | -- DELIVERY_ADDRESS |
| | 93 | INSERT INTO delivery_address (client_ID, address, city, postcode, country, is_default) VALUES |
| | 94 | (1001, 'st.Partizanska 10', 'Skopje', '1000', 'Macedonia', TRUE), |
| | 95 | (1002, 'st.Turisticka 5', 'Bitola', '7000', 'Macedonia', TRUE), |
| | 96 | (1003, 'st.32 br.4', 'Cucer-Sandevo', '1011', 'Macedonia', TRUE), |
| | 97 | (1004, 'st.Bul.Kuzman Josifovski Pitu 15', 'Skopje', '1000', 'Macedonia', TRUE), |
| | 98 | (1006, 'st.Makedonska Brigada 22', 'Ohrid', '6000', 'Macedonia', TRUE), |
| | 99 | (1003, 'Campus Dormitory, Room 305', 'Skopje', '1000', 'Macedonia', FALSE); -- Second address for client 3 |
| | 100 | |
| | 101 | -- ORDER (updated with correct constraints) |
| | 102 | INSERT INTO "order" (order_num, client_ID, status, last_date_mod, payment_method, discount) VALUES |
| | 103 | ('002202500001', 1001, 'placed order', '2025-12-01 10:15:00', 'credit card ****6750', 0.00), |
| | 104 | ('002202500002', 1001, 'being processed', '2025-12-10 18:00:00', 'PayPal account user123', 0.00), |
| | 105 | ('001202500001', 1002, 'delivered', '2025-12-02 14:30:00', 'cash', 4.00), |
| | 106 | ('003202500001', 1003, 'shipping', '2025-12-05 09:45:00', 'credit card ****1234', 10.00), |
| | 107 | ('002202500003', 1004, 'canceled', '2025-12-03 16:20:00', 'credit card ****9876', 0.00), |
| | 108 | ('001202500002', 1006, 'delivered', '2025-12-08 11:30:00', 'bank transfer', 5.50); |
| | 109 | |
| | 110 | -- REPORT |
| | 111 | INSERT INTO report (date, store_ID, overall_profit, sales_trend, marketing_growth, owner_signature) VALUES |
| | 112 | ('2024-11-30 23:59:59', '001', 125000.00, 'Increasing', 'Stable growth', 'M.Petrovski'), |
| | 113 | ('2024-11-30 23:59:59', '002', 98000.00, 'Stable', 'Moderate growth', 'S.Vaneva'), |
| | 114 | ('2024-11-30 23:59:59', '003', 75000.00, 'Growing', 'Rapid growth', 'D.Ristevski'), |
| | 115 | ('2024-12-31 23:59:59', '001', 135000.00, 'Increasing', 'Good growth', 'M.Petrovski'), |
| | 116 | ('2024-12-31 23:59:59', '002', 105000.00, 'Stable', 'Moderate growth', 'S.Vaneva'); |
| | 117 | |
| | 118 | -- MONTHLY_PROFIT |
| | 119 | INSERT INTO monthly_profit (report_date, store_ID, month_and_year profit) VALUES |
| | 120 | ('2024-11-30 23:59:59', '001', 'November 2024', 12500.00), |
| | 121 | ('2024-11-30 23:59:59', '002', 'November 2024', 8000.00), |
| | 122 | ('2024-11-30 23:59:59', '003', 'November 2024', 6500.00), |
| | 123 | ('2024-12-31 23:59:59', '001', 'December 2024', 14500.00), |
| | 124 | ('2024-12-31 23:59:59', '002', 'December 2024', 9000.00); |
| | 125 | |
| | 126 | -- REQUEST |
| | 127 | INSERT INTO request (request_num, date_and_time, problem, notes_of_communication, customer_satisfaction) VALUES |
| | 128 | ('00111202500101', '2024-11-03 11:20:00', 'Late delivery', 'Apologized and offered discount', 4.0), |
| | 129 | ('00212202500102', '2024-12-04 09:10:00', 'Military discount inquiry', 'Discount approved for active duty personnel', 5.0), |
| | 130 | ('00312202500101', '2024-12-10 14:30:00', 'Product damage during shipping', 'Replacement sent, offered refund option', 3.5), |
| | 131 | ('00112202500201', '2024-12-15 16:45:00', 'Custom order request', 'Discussed custom design options', 4.5); |
| | 132 | |
| | 133 | -- MAKES_REQUEST |
| | 134 | INSERT INTO makes_request (client_ID, request_num) VALUES |
| | 135 | (1003, '00312202500101'), |
| | 136 | (1002, '00111202500101'), |
| | 137 | (1001, '00212202500102'), |
| | 138 | (1004, '00112202500201'); |
| | 139 | |
| | 140 | -- ANSWERS |
| | 141 | INSERT INTO answers (request_num, personal_SSN) VALUES |
| | 142 | ('00111202500101', '4567891234567'), |
| | 143 | ('00212202500102', '1234567890123'), |
| | 144 | ('00312202500101', '7891234567890'), |
| | 145 | ('00112202500201', '9876543210987'); |
| | 146 | |
| | 147 | -- FOR_STORE (Probably not needed as you can get it from the first 3 digits of the request number) |
| | 148 | INSERT INTO for_store (request_num, store_ID) VALUES |
| | 149 | ('00212202500102', '002'), |
| | 150 | ('00111202500101', '001'), |
| | 151 | ('00312202500101', '003'), |
| | 152 | ('00112202500201', '001'); |
| | 153 | |
| | 154 | -- REVIEW |
| | 155 | INSERT INTO review (order_num, comment, rating, last_mod_date) VALUES |
| | 156 | ('001202500001', 'Great quality, slightly late delivery', 4.0, '2024-12-05 18:00:00'), |
| | 157 | ('001202500002', 'Beautiful craftsmanship, exactly as pictured', 5.0, '2024-12-10 10:30:00'), |
| | 158 | ('003202500001', '', 4.5, '2024-12-12 14:15:00'); |
| | 159 | |
| | 160 | -- CHANGE |
| | 161 | INSERT INTO "change" (date_and_time, product_code, changes) VALUES |
| | 162 | ('2024-11-10 09:00:00', '00100001', 'FROM aprox_production_time=14 TO aprox_production_time=10'), |
| | 163 | ('2024-11-12 15:30:00', '00200001', 'Added new color options: Purple, Pink'), |
| | 164 | ('2024-12-01 11:00:00', '00100002', 'Price increased from 1100 to 1200 due to material costs'), |
| | 165 | ('2024-12-05 14:20:00', '00200002', 'Production time reduced from 16 to 14 days'); |
| | 166 | |
| | 167 | -- MAKES_CHANGE |
| | 168 | INSERT INTO makes_change (personal_SSN, change_date_time, product_code) VALUES |
| | 169 | ('1234567890123', '2024-11-10 09:00:00', '00100001'), |
| | 170 | ('4567891234567', '2024-11-12 15:30:00', '00200001'), |
| | 171 | ('7891234567890', '2024-12-01 11:00:00', '00100002'), |
| | 172 | ('9876543210987', '2024-12-05 14:20:00', '00200002'); |
| | 173 | |
| | 174 | -- WORKS_IN_STORE |
| | 175 | INSERT INTO works_in_store (personal_SSN, store_ID) VALUES |
| | 176 | ('1234567890123', '001'), |
| | 177 | ('9876543210987', '001'), |
| | 178 | ('4567891234567', '002'), |
| | 179 | ('7891234567890', '003'), |
| | 180 | ('3216549870123', '002'), |
| | 181 | ('9876543210987', '003'); -- Employee works in multiple stores, probably need to have employee ID |
| | 182 | |
| | 183 | -- WORKED |
| | 184 | INSERT INTO worked (personal_SSN, report_date, store_ID, wage, pay_method, total_hours, week) VALUES |
| | 185 | ('1234567890123', '2024-11-30 23:59:59', '001', 75, 'hourly', 48, '2024-11-24 - 2024-11-30'), |
| | 186 | ('9876543210987', '2024-11-30 23:59:59', '001', 75, 'hourly', 38, '2024-11-24 - 2024-11-30'), |
| | 187 | ('4567891234567', '2024-11-30 23:59:59', '002', 10000, 'monthly', 52, '2024-11-24 - 2024-11-30'), |
| | 188 | ('7891234567890', '2024-11-30 23:59:59', '003', 65, 'hourly', 42, '2024-11-24 - 2024-11-30'), |
| | 189 | ('3216549870123', '2024-11-30 23:59:59', '002', 60, 'hourly', 40, '2024-11-24 - 2024-11-30'); |
| | 190 | |
| | 191 | -- SELLS |
| | 192 | INSERT INTO sells (product_code, store_ID, discount) VALUES |
| | 193 | ('00100001', '001', 0.0), |
| | 194 | ('00100002', '001', 5.0), |
| | 195 | ('00200001', '002', 0.0), |
| | 196 | ('00200002', '002', 0.5), |
| | 197 | ('00200002', '003', 0.3), |
| | 198 | ('00200003', '003', 0.0), |
| | 199 | ('00200001', '003', 0.2); |
| | 200 | |
| | 201 | -- INCLUDES |
| | 202 | INSERT INTO includes (order_num, product_code) VALUES |
| | 203 | ('001202500001', '00100001'), |
| | 204 | ('002202500001', '00200002'), |
| | 205 | ('002202500002', '00200001'), |
| | 206 | ('003202500001', '00200002'), |
| | 207 | ('003202500001', '00200003'), |
| | 208 | ('001202500002', '00100001'), |
| | 209 | ('001202500002', '00200001'); |
| | 210 | |
| | 211 | -- APPROVES |
| | 212 | INSERT INTO approves (boss_SSN, report_date, store_ID, owner_signature) VALUES |
| | 213 | ('1234567890123', '2024-11-30 23:59:59', '001', 'M.Petrovski'), |
| | 214 | ('4567891234567', '2024-11-30 23:59:59', '002', 'S.Vaneva'), |
| | 215 | ('1234567890123', '2024-12-31 23:59:59', '001', 'M.Petrovski'), |
| | 216 | ('4567891234567', '2024-12-31 23:59:59', '002', 'S.Vaneva'); |
| | 217 | |
| | 218 | -- EXCHANGES_DATA |
| | 219 | INSERT INTO exchanges_data (report_date, store_ID, monthly_profit, date, sales, damages) VALUES -- Report_id??? |
| | 220 | ('2024-11-30 23:59:59', '001', 38750.00, '2024-11-30 20:00:00', 52, 750.00), |
| | 221 | ('2024-11-30 23:59:59', '002', 26150.00, '2024-11-30 20:00:00', 40, 0.00), |
| | 222 | ('2024-11-30 23:59:59', '003', 19500.00, '2024-11-30 20:00:00', 35, 250.00), |
| | 223 | ('2024-12-31 23:59:59', '001', 41250.00, '2025-12-31 20:00:00', 58, 1200.00), |
| | 224 | ('2024-12-31 23:59:59', '002', 28500.00, '2025-12-31 20:00:00', 45, 500.00); |
| | 225 | |
| | 226 | -- REFUND |
| | 227 | INSERT INTO refund (order_num, amount, reason, status) VALUES |
| | 228 | ('002202500003', 199.00, 'Customer changed mind before shipping', 'processed'), |
| | 229 | ('001202500001', 50.00, 'Partial refund for late delivery', 'approved'), |
| | 230 | ('003202500001', 89.99, 'One item damaged during shipping', 'pending'), |
| | 231 | ('001202500002', 75.00, 'Price adjustment after promotion', 'declined'); |
| | 232 | |
| | 233 | |
| | 234 | }}} |