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