| 1 | SET search_path TO project;
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 | TRUNCATE TABLE
|
|---|
| 5 | MODIFICATION_PRODUCTS,
|
|---|
| 6 | SONG_ARTISTS,
|
|---|
| 7 | RELEASE_ARTISTS,
|
|---|
| 8 | ALBUM_SONGS,
|
|---|
| 9 | WISHLIST_ITEMS,
|
|---|
| 10 | ORDER_ITEMS,
|
|---|
| 11 | MODIFICATIONS,
|
|---|
| 12 | WISHLISTS,
|
|---|
| 13 | ORDERS,
|
|---|
| 14 | PRODUCTS,
|
|---|
| 15 | SONGS,
|
|---|
| 16 | ALBUMS,
|
|---|
| 17 | SINGLE_RELEASES,
|
|---|
| 18 | RELEASES,
|
|---|
| 19 | ARTISTS,
|
|---|
| 20 | CONSUMERS,
|
|---|
| 21 | ADMINS,
|
|---|
| 22 | USERS
|
|---|
| 23 | RESTART IDENTITY CASCADE;
|
|---|
| 24 |
|
|---|
| 25 | -- USERS
|
|---|
| 26 |
|
|---|
| 27 | INSERT INTO USERS
|
|---|
| 28 | (user_id, email, username, password, date_created, shipping_address, telephone_number)
|
|---|
| 29 | VALUES
|
|---|
| 30 | (1, 'marko@gmail.com', 'markzzy', 'hashed_pw_1', '2025-01-12', 'Rugjer Boshkovikj 16, Skopje, Macedonia 1000', '+38971123456'),
|
|---|
| 31 | (2, 'darko@gmail.com', 'dar4e', 'hashed_pw_2', '2025-01-13', 'Ohrid, Macedonia', '+38970222333'),
|
|---|
| 32 | (3, 'stefan@gmail.com', 'steff', 'hashed_pw_3', '2025-01-14', 'Partizanski Odredi 102, Skopje, Macedonia 1000', '+38970333444'),
|
|---|
| 33 | (4, 'admin@kernelrecords.com', 'admin', 'hashed_admin_pw', '2025-01-01', NULL, NULL),
|
|---|
| 34 | (5, 'strajk@gmail.com', 'strajk', 'hashed_pw_5', '2025-02-01', 'Ulica', '+38970444555'),
|
|---|
| 35 | (6, 'kiro@hotmail.com', 'kirca', 'hashed_pw_6', '2025-02-03', 'Prilep, Macedonia', '+38970555666');
|
|---|
| 36 |
|
|---|
| 37 | -- ADMINS
|
|---|
| 38 |
|
|---|
| 39 | INSERT INTO ADMINS
|
|---|
| 40 | (user_id, type, discount_percentage)
|
|---|
| 41 | VALUES
|
|---|
| 42 | (4, 'SUPER_ADMIN', 20);
|
|---|
| 43 |
|
|---|
| 44 | -- CONSUMERS
|
|---|
| 45 |
|
|---|
| 46 | INSERT INTO CONSUMERS
|
|---|
| 47 | (user_id, points_collected)
|
|---|
| 48 | VALUES
|
|---|
| 49 | (1, 1337),
|
|---|
| 50 | (2, 69),
|
|---|
| 51 | (3, 450),
|
|---|
| 52 | (5, 90),
|
|---|
| 53 | (6, 310);
|
|---|
| 54 |
|
|---|
| 55 | -- ARTISTS
|
|---|
| 56 |
|
|---|
| 57 | INSERT INTO ARTISTS
|
|---|
| 58 | (artist_id, artist_name, description, photo)
|
|---|
| 59 | VALUES
|
|---|
| 60 | (1, 'Kanye West', 'American rapper and producer', 'kanye.jpg'),
|
|---|
| 61 | (2, 'Travis Scott', 'American rapper and producer', 'travisscott.jpg'),
|
|---|
| 62 | (3, 'Nas', 'American rapper', 'nas.jpg'),
|
|---|
| 63 | (4, 'Nirvana', 'American grunge band', 'nirvana.jpg'),
|
|---|
| 64 | (5, 'Michael Jackson', 'American pop singer', 'mj.jpg'),
|
|---|
| 65 |
|
|---|
| 66 | (6, 'T-Pain', 'American rapper and singer', 'tpain.jpg'),
|
|---|
| 67 | (7, 'Lil Wayne', 'American rapper', 'lilwayne.jpg'),
|
|---|
| 68 | (8, 'Mos Def', 'American rapper and actor', 'mosdef.jpg'),
|
|---|
| 69 | (9, 'Dwele', 'American singer', 'dwele.jpg'),
|
|---|
| 70 | (10, 'Chris Martin', 'Lead singer of Coldplay', 'chrismartin.jpg'),
|
|---|
| 71 | (11, 'Quavo', 'American rapper', 'quavo.jpg'),
|
|---|
| 72 | (12, 'Future', 'American rapper', 'future.jpg'),
|
|---|
| 73 | (13, '2 Chainz', 'American rapper', '2chainz.jpg'),
|
|---|
| 74 | (14, 'Juicy J', 'American rapper', 'juicyj.jpg'),
|
|---|
| 75 | (15, 'The Weeknd', 'Canadian singer', 'weeknd.jpg'),
|
|---|
| 76 | (16, 'Kacy Hill', 'American singer', 'kacyhill.jpg'),
|
|---|
| 77 | (17, 'Justin Bieber', 'Canadian singer', 'bieber.jpg'),
|
|---|
| 78 | (18, 'Young Thug', 'American rapper', 'youngthug.jpg'),
|
|---|
| 79 | (19, 'Swae Lee', 'American rapper and singer', 'swaelee.jpg'),
|
|---|
| 80 | (20, 'Chief Keef', 'American rapper', 'chiefkeef.jpg'),
|
|---|
| 81 | (21, 'Toro y Moi', 'American singer', 'toroymoi.jpg'),
|
|---|
| 82 | (22, 'AZ', 'American rapper', 'az.jpg'),
|
|---|
| 83 | (23, 'Paul McCartney', 'English singer-songwriter', 'paul.jpg'),
|
|---|
| 84 |
|
|---|
| 85 | (24, 'Beatles', 'English rock band', 'beatles.jpg'),
|
|---|
| 86 | (25, 'Eminem', 'American rapper', 'eminem.jpg');
|
|---|
| 87 |
|
|---|
| 88 | -- RELEASES
|
|---|
| 89 |
|
|---|
| 90 | INSERT INTO RELEASES
|
|---|
| 91 | (release_id, title, record_label, genre, release_date, cover_photo)
|
|---|
| 92 | VALUES
|
|---|
| 93 | (1, 'Graduation', 'Def Jam', 'Hip Hop', '2007-09-11', 'graduation.jpg'),
|
|---|
| 94 | (2, 'Rodeo', 'Grand Hustle', 'Hip Hop', '2015-09-04', 'rodeo.jpg'),
|
|---|
| 95 | (3, 'Illmatic', 'Columbia Records', 'Hip Hop', '1994-04-19', 'illmatic.jpg'),
|
|---|
| 96 | (4, 'Nevermind', 'DGC Records', 'Grunge', '1991-09-24', 'nevermind.jpg'),
|
|---|
| 97 | (5, 'Thriller', 'Epic Records', 'Pop', '1982-11-30', 'thriller.jpg'),
|
|---|
| 98 |
|
|---|
| 99 | (6, 'Hey Jude', 'Apple Records', 'Rock', '1968-08-26', 'hey_jude.jpg'),
|
|---|
| 100 | (7, 'Lose Yourself', 'Shady Records', 'Hip Hop', '2002-10-28', 'lose_yourself.jpg');
|
|---|
| 101 |
|
|---|
| 102 |
|
|---|
| 103 | -- ALBUMS
|
|---|
| 104 |
|
|---|
| 105 | INSERT INTO ALBUMS
|
|---|
| 106 | (release_id)
|
|---|
| 107 | VALUES
|
|---|
| 108 | (1),
|
|---|
| 109 | (2),
|
|---|
| 110 | (3),
|
|---|
| 111 | (4),
|
|---|
| 112 | (5);
|
|---|
| 113 |
|
|---|
| 114 | -- SINGLES
|
|---|
| 115 | INSERT INTO SINGLE_RELEASES
|
|---|
| 116 | (release_id, duration)
|
|---|
| 117 | VALUES
|
|---|
| 118 | (6, '7:12'),
|
|---|
| 119 | (7, '5:26');
|
|---|
| 120 |
|
|---|
| 121 | -- SONGS
|
|---|
| 122 |
|
|---|
| 123 | INSERT INTO SONGS
|
|---|
| 124 | (song_id, song_name, duration)
|
|---|
| 125 | VALUES
|
|---|
| 126 |
|
|---|
| 127 | -- Graduation
|
|---|
| 128 | (1, 'Good Morning', '2:42'),
|
|---|
| 129 | (2, 'Champion', '2:46'),
|
|---|
| 130 | (3, 'Stronger', '5:12'),
|
|---|
| 131 | (4, 'I Wonder', '4:04'),
|
|---|
| 132 | (5, 'Good Life', '3:27'),
|
|---|
| 133 | (6, 'Can''t Tell Me Nothing', '4:32'),
|
|---|
| 134 | (7, 'Barry Bonds', '3:18'),
|
|---|
| 135 | (8, 'Drunk and Hot Girls', '4:35'),
|
|---|
| 136 | (9, 'Flashing Lights', '3:59'),
|
|---|
| 137 | (10, 'Everything I Am', '3:57'),
|
|---|
| 138 | (11, 'The Glory', '4:04'),
|
|---|
| 139 | (12, 'Homecoming', '3:28'),
|
|---|
| 140 | (13, 'Big Brother', '5:00'),
|
|---|
| 141 |
|
|---|
| 142 | -- Rodeo
|
|---|
| 143 | (14, 'Pornography', '5:16'),
|
|---|
| 144 | (15, 'Oh My Dis Side', '3:57'),
|
|---|
| 145 | (16, '3500', '8:48'),
|
|---|
| 146 | (17, 'Wasted', '3:47'),
|
|---|
| 147 | (18, 'Piss on Your Grave', '3:04'),
|
|---|
| 148 | (19, 'Antidote', '3:39'),
|
|---|
| 149 | (20, 'Get High', '3:00'),
|
|---|
| 150 | (21, 'Pray 4 Love', '4:13'),
|
|---|
| 151 | (22, 'I Can Tell', '2:44'),
|
|---|
| 152 | (23, '90210', '7:41'),
|
|---|
| 153 | (24, 'Coordinate', '4:17'),
|
|---|
| 154 | (25, 'Maria I''m Drunk', '4:04'),
|
|---|
| 155 | (26, 'Nightcrawler', '5:48'),
|
|---|
| 156 | (27, 'Flying High', '3:48'),
|
|---|
| 157 |
|
|---|
| 158 | -- Illmatic
|
|---|
| 159 | (28, 'The Genesis', '1:02'),
|
|---|
| 160 | (29, 'N.Y. State of Mind', '4:55'),
|
|---|
| 161 | (30, 'Life''s a Bitch', '3:36'),
|
|---|
| 162 | (31, 'The World Is Yours', '4:50'),
|
|---|
| 163 | (32, 'Halftime', '4:18'),
|
|---|
| 164 | (33, 'Memory Lane (Sittin'' in da Park)', '4:25'),
|
|---|
| 165 | (34, 'One Love', '5:31'),
|
|---|
| 166 | (35, 'One Time 4 Your Mind', '3:25'),
|
|---|
| 167 | (36, 'Represent', '3:42'),
|
|---|
| 168 | (37, 'It Ain''t Hard to Tell', '3:53'),
|
|---|
| 169 |
|
|---|
| 170 | -- Nevermind
|
|---|
| 171 | (38, 'Smells Like Teen Spirit', '5:01'),
|
|---|
| 172 | (39, 'In Bloom', '4:15'),
|
|---|
| 173 | (40, 'Come as You Are', '3:38'),
|
|---|
| 174 | (41, 'Breed', '3:04'),
|
|---|
| 175 | (42, 'Lithium', '4:17'),
|
|---|
| 176 | (43, 'Polly', '2:57'),
|
|---|
| 177 | (44, 'Territorial Pissings', '2:23'),
|
|---|
| 178 | (45, 'Drain You', '3:44'),
|
|---|
| 179 | (46, 'Lounge Act', '2:37'),
|
|---|
| 180 | (47, 'Stay Away', '3:32'),
|
|---|
| 181 | (48, 'On a Plain', '3:16'),
|
|---|
| 182 | (49, 'Something in the Way', '3:51'),
|
|---|
| 183 |
|
|---|
| 184 | -- Thriller
|
|---|
| 185 | (50, 'Wanna Be Startin'' Somethin''', '6:03'),
|
|---|
| 186 | (51, 'Baby Be Mine', '4:20'),
|
|---|
| 187 | (52, 'The Girl Is Mine', '3:42'),
|
|---|
| 188 | (53, 'Thriller', '5:57'),
|
|---|
| 189 | (54, 'Beat It', '4:18'),
|
|---|
| 190 | (55, 'Billie Jean', '4:54'),
|
|---|
| 191 | (56, 'Human Nature', '4:06'),
|
|---|
| 192 | (57, 'P.Y.T. (Pretty Young Thing)', '3:59'),
|
|---|
| 193 | (58, 'The Lady in My Life', '4:57');
|
|---|
| 194 |
|
|---|
| 195 | -- PRODUCTS
|
|---|
| 196 |
|
|---|
| 197 | INSERT INTO PRODUCTS
|
|---|
| 198 | (product_id, release_id, format, price, description, stock)
|
|---|
| 199 | VALUES
|
|---|
| 200 | (1, 1, 'VINYL', 39.99, 'Graduation Vinyl Edition', 15),
|
|---|
| 201 | (2, 1, 'CD', 14.99, 'Graduation CD Edition', 25),
|
|---|
| 202 |
|
|---|
| 203 | (3, 2, 'VINYL', 42.99, 'Rodeo Vinyl Edition', 10),
|
|---|
| 204 | (4, 2, 'CD', 15.99, 'Rodeo CD Edition', 20),
|
|---|
| 205 |
|
|---|
| 206 | (5, 3, 'VINYL', 44.99, 'Illmatic Vinyl Edition', 12),
|
|---|
| 207 | (6, 3, 'CD', 13.99, 'Illmatic CD Edition', 30),
|
|---|
| 208 |
|
|---|
| 209 | (7, 4, 'VINYL', 37.99, 'Nevermind Vinyl Edition', 18),
|
|---|
| 210 | (8, 4, 'CD', 12.99, 'Nevermind CD Edition', 35),
|
|---|
| 211 |
|
|---|
| 212 | (9, 5, 'VINYL', 49.99, 'Thriller Vinyl Edition', 20),
|
|---|
| 213 | (10, 5, 'CD', 16.99, 'Thriller CD Edition', 40),
|
|---|
| 214 |
|
|---|
| 215 | (11, 6, 'VINYL', 74.99, 'Hey Jude Vinyl Special Edition', 10),
|
|---|
| 216 |
|
|---|
| 217 | (12, 7, 'CD', 99.99, 'Lose Yourself CD Edition - Signed', 5);
|
|---|
| 218 |
|
|---|
| 219 | -- ALBUM SONGS
|
|---|
| 220 |
|
|---|
| 221 | INSERT INTO ALBUM_SONGS
|
|---|
| 222 | (album_id, song_id)
|
|---|
| 223 | VALUES
|
|---|
| 224 | (1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(1,7),(1,8),(1,9),(1,10),(1,11),(1,12),(1,13),
|
|---|
| 225 | (2,14),(2,15),(2,16),(2,17),(2,18),(2,19),(2,20),(2,21),(2,22),(2,23),(2,24),(2,25),(2,26),(2,27),
|
|---|
| 226 | (3,28),(3,29),(3,30),(3,31),(3,32),(3,33),(3,34),(3,35),(3,36),(3,37),
|
|---|
| 227 | (4,38),(4,39),(4,40),(4,41),(4,42),(4,43),(4,44),(4,45),(4,46),(4,47),(4,48),(4,49),
|
|---|
| 228 | (5,50),(5,51),(5,52),(5,53),(5,54),(5,55),(5,56),(5,57),(5,58);
|
|---|
| 229 |
|
|---|
| 230 | -- RELEASE ARTISTS
|
|---|
| 231 |
|
|---|
| 232 | INSERT INTO RELEASE_ARTISTS
|
|---|
| 233 | (release_id, artist_id)
|
|---|
| 234 | VALUES
|
|---|
| 235 | (1,1),
|
|---|
| 236 | (2,2),
|
|---|
| 237 | (3,3),
|
|---|
| 238 | (4,4),
|
|---|
| 239 | (5,5),
|
|---|
| 240 | (6,24),
|
|---|
| 241 | (7,25);
|
|---|
| 242 |
|
|---|
| 243 | -- SONG ARTISTS
|
|---|
| 244 |
|
|---|
| 245 | INSERT INTO SONG_ARTISTS
|
|---|
| 246 | (song_id, artist_id)
|
|---|
| 247 | VALUES
|
|---|
| 248 | -- Kanye West - Graduation
|
|---|
| 249 | (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),
|
|---|
| 250 | (7,1),(8,1),(9,1),(10,1),(11,1),(12,1),(13,1),
|
|---|
| 251 |
|
|---|
| 252 | -- Graduation Features
|
|---|
| 253 | (5,6), -- T-Pain on "Good Life"
|
|---|
| 254 | (7,7), -- Lil Wayne on "Barry Bonds"
|
|---|
| 255 | (8,8), -- Mos Def on "Drunk and Hot Girls"
|
|---|
| 256 | (9,9), -- Dwele on "Flashing Lights"
|
|---|
| 257 | (12,10), -- Chris Martin on "Homecoming"
|
|---|
| 258 |
|
|---|
| 259 | -- Travis Scott - Rodeo
|
|---|
| 260 | (14,2),(15,2),(16,2),(17,2),(18,2),(19,2),
|
|---|
| 261 | (20,2),(21,2),(22,2),(23,2),(24,2),(25,2),
|
|---|
| 262 | (26,2),(27,2),
|
|---|
| 263 |
|
|---|
| 264 | -- Rodeo Features
|
|---|
| 265 | (15,11), -- Quavo on "Oh My Dis Side"
|
|---|
| 266 | (16,12), -- Future on "3500"
|
|---|
| 267 | (16,13), -- 2 Chainz on "3500"
|
|---|
| 268 | (17,14), -- Juicy J on "Wasted"
|
|---|
| 269 | (18,1), -- Kanye West on "Piss on Your Grave"
|
|---|
| 270 | (21,15), -- The Weeknd on "Pray 4 Love"
|
|---|
| 271 | (23,16), -- Kacy Hill on "90210"
|
|---|
| 272 | (25,17), -- Justin Bieber on "Maria I'm Drunk"
|
|---|
| 273 | (25,18), -- Young Thug on "Maria I'm Drunk"
|
|---|
| 274 | (26,19), -- Swae Lee on "Nightcrawler"
|
|---|
| 275 | (26,20), -- Chief Keef on "Nightcrawler"
|
|---|
| 276 | (27,21), -- Toro y Moi on "Flying High"
|
|---|
| 277 |
|
|---|
| 278 | -- Nas - Illmatic
|
|---|
| 279 | (28,3),(29,3),(30,3),(31,3),(32,3),
|
|---|
| 280 | (33,3),(34,3),(35,3),(36,3),(37,3),
|
|---|
| 281 |
|
|---|
| 282 | -- Illmatic Features
|
|---|
| 283 | (30,22), -- AZ on "Life's a Bitch"
|
|---|
| 284 |
|
|---|
| 285 | -- Nirvana - Nevermind
|
|---|
| 286 | (38,4),(39,4),(40,4),(41,4),(42,4),(43,4),
|
|---|
| 287 | (44,4),(45,4),(46,4),(47,4),(48,4),(49,4),
|
|---|
| 288 |
|
|---|
| 289 | -- Michael Jackson - Thriller
|
|---|
| 290 | (50,5),(51,5),(52,5),(53,5),(54,5),
|
|---|
| 291 | (55,5),(56,5),(57,5),(58,5),
|
|---|
| 292 |
|
|---|
| 293 | -- Thriller Features
|
|---|
| 294 | (52,23); -- Paul McCartney on "The Girl Is Mine"
|
|---|
| 295 |
|
|---|
| 296 |
|
|---|
| 297 | -- WISHLISTS
|
|---|
| 298 |
|
|---|
| 299 | INSERT INTO WISHLISTS
|
|---|
| 300 | (wishlist_id, user_id)
|
|---|
| 301 | VALUES
|
|---|
| 302 | (1,1),
|
|---|
| 303 | (2,2),
|
|---|
| 304 | (3,3),
|
|---|
| 305 | (4,5),
|
|---|
| 306 | (5,6);
|
|---|
| 307 |
|
|---|
| 308 | -- WISHLIST ITEMS
|
|---|
| 309 |
|
|---|
| 310 | INSERT INTO WISHLIST_ITEMS
|
|---|
| 311 | (wishlist_id, product_id, added_at)
|
|---|
| 312 | VALUES
|
|---|
| 313 | (1,1,'2024-09-21'),
|
|---|
| 314 | (1,2,'2026-11-01'),
|
|---|
| 315 | (1,3,'2026-09-06'),
|
|---|
| 316 | (2,5,'2023-01-01'),
|
|---|
| 317 | (2,7,'2026-02-02'),
|
|---|
| 318 | (3,7,'2025-05-04'),
|
|---|
| 319 | (4,9,'2026-01-05'),
|
|---|
| 320 | (5,2,'2024-03-06');
|
|---|
| 321 |
|
|---|
| 322 | -- ORDERS
|
|---|
| 323 |
|
|---|
| 324 | INSERT INTO ORDERS
|
|---|
| 325 | (order_id, user_id, payment_method, purchase_date, points_earned, points_used, status)
|
|---|
| 326 | VALUES
|
|---|
| 327 | (1,1,'CARD','2026-01-01',40,10,'DELIVERED'),
|
|---|
| 328 | (2,2,'PAYPAL','2026-08-02',20,0,'SHIPPED'),
|
|---|
| 329 | (3,3,'CASH','2026-10-11',30,5,'PAID'),
|
|---|
| 330 | (4,5,'CARD','2026-03-31',15,0,'PENDING'),
|
|---|
| 331 | (5,1,'PAYPAL','2026-04-20',69,0,'PAID');
|
|---|
| 332 |
|
|---|
| 333 | -- ORDER ITEMS
|
|---|
| 334 |
|
|---|
| 335 | INSERT INTO ORDER_ITEMS
|
|---|
| 336 | (order_id, product_id, price_at_purchase, quantity)
|
|---|
| 337 | VALUES
|
|---|
| 338 | (1,1,39.99,1),
|
|---|
| 339 | (1,2,14.99,4),
|
|---|
| 340 | (2,3,42.99,1),
|
|---|
| 341 | (3,5,44.99,3),
|
|---|
| 342 | (4,9,49.99,1),
|
|---|
| 343 | (5,12,79.99,2);
|
|---|
| 344 |
|
|---|
| 345 | -- MODIFICATIONS
|
|---|
| 346 |
|
|---|
| 347 | INSERT INTO MODIFICATIONS
|
|---|
| 348 | (modification_id, admin_id, date_modified, type_of_modification, discount)
|
|---|
| 349 | VALUES
|
|---|
| 350 | (1,4,'2026-02-01','CREATE',NULL),
|
|---|
| 351 | (2,4,'2026-02-10','UPDATE',NULL),
|
|---|
| 352 | (3,4,'2026-04-20','DISCOUNT',20),
|
|---|
| 353 | (4,4,'2026-03-15','DELETE',NULL);
|
|---|
| 354 |
|
|---|
| 355 | -- MODIFICATION PRODUCTS
|
|---|
| 356 |
|
|---|
| 357 | INSERT INTO MODIFICATION_PRODUCTS
|
|---|
| 358 | (modification_id, product_id)
|
|---|
| 359 | VALUES
|
|---|
| 360 | (1,1),
|
|---|
| 361 | (1,2),
|
|---|
| 362 | (2,3),
|
|---|
| 363 | (2,4),
|
|---|
| 364 | (3,5),
|
|---|
| 365 | (3,6),
|
|---|
| 366 | (4,10); |
|---|