CinemaDB/Faza2B: CinemaDBinsertpodatoci.sql

File CinemaDBinsertpodatoci.sql, 70.9 KB (added by 233280, 5 days ago)
Line 
1-----внесување во табелата Genre
2INSERT INTO public.Genre (name, description)
3SELECT
4 genre,
5 'Description for ' || genre
6FROM unnest(ARRAY[
7 'Action','Comedy','Drama','Horror','Sci-Fi',
8 'Romance','Thriller','Animation','Documentary','Fantasy',
9 'Mystery','Adventure','Crime','Biography','History',
10 'Music','Sport','War','Western','Family'
11]) AS genre;
12-----внесување во табелата Movie со вистински филмови
13INSERT INTO Movie (title, release_year, duration, language, description)
14VALUES
15('The Shawshank Redemption', 1994, 142, 'English', 'Two imprisoned men bond over years.'),
16('The Godfather', 1972, 175, 'English', 'The aging patriarch of a crime dynasty.'),
17('The Dark Knight', 2008, 152, 'English', 'Batman faces the Joker in Gotham.'),
18('Schindlers List', 1993, 195, 'English', 'A businessman saves Jewish refugees.'),
19('The Lord of the Rings: The Return of the King', 2003, 201, 'English', 'The final battle for Middle-earth.'),
20('Pulp Fiction', 1994, 154, 'English', 'Interconnected stories of crime in LA.'),
21('Forrest Gump', 1994, 142, 'English', 'Life is like a box of chocolates.'),
22('Inception', 2010, 148, 'English', 'A thief enters dreams to steal secrets.'),
23('The Matrix', 1999, 136, 'English', 'A hacker discovers a simulated reality.'),
24('Goodfellas', 1990, 146, 'English', 'Rise and fall of a mob associate.'),
25('Interstellar', 2014, 169, 'English', 'Astronauts travel through a wormhole.'),
26('The Silence of the Lambs', 1991, 118, 'English', 'An FBI agent seeks help from Hannibal Lecter.'),
27('Saving Private Ryan', 1998, 169, 'English', 'WWII soldiers search for a paratrooper.'),
28('Gladiator', 2000, 155, 'English', 'A Roman general seeks revenge as a slave.'),
29('The Lion King', 1994, 88, 'English', 'A lion cub flees and reclaims his kingdom.'),
30('Titanic', 1997, 194, 'English', 'A love story aboard a doomed ship.'),
31('Jurassic Park', 1993, 127, 'English', 'Dinosaurs run amok on an island.'),
32('The Avengers', 2012, 143, 'English', 'Superheroes unite to save the world.'),
33('Avatar', 2009, 162, 'English', 'A marine on an alien planet.'),
34('Fight Club', 1999, 139, 'English', 'An insomniac forms an underground club.'),
35('The Prestige', 2006, 130, 'English', 'Two magicians enter a dangerous rivalry.'),
36('Whiplash', 2014, 107, 'English', 'A drummer pursues greatness at any cost.'),
37('The Grand Budapest Hotel', 2014, 99, 'English', 'Adventures of a legendary concierge.'),
38('Mad Max: Fury Road', 2015, 120, 'English', 'A chase across a post-apocalyptic wasteland.'),
39('The Revenant', 2015, 156, 'English', 'A frontiersman on a quest for survival.'),
40('Parasite', 2019, 132, 'Korean', 'A poor family infiltrates a wealthy household.'),
41('Spirited Away', 2001, 125, 'Japanese', 'A girl trapped in a spirit world.'),
42('Your Name', 2016, 106, 'Japanese', 'Two strangers swap bodies mysteriously.'),
43('Oldboy', 2003, 120, 'Korean', 'A man is imprisoned for fifteen years.'),
44('Amelie', 2001, 122, 'French', 'A shy waitress improves others lives.'),
45('City of God', 2002, 130, 'Spanish', 'Growing up amid violence in Rio.'),
46('Pan''s Labyrinth', 2006, 118, 'Spanish', 'A girl escapes into a dark fantasy.'),
47('The Intouchables', 2011, 112, 'French', 'An unlikely friendship between opposites.'),
48('Cinema Paradiso', 1988, 155, 'Italian', 'A filmmaker recalls his childhood love of film.'),
49('Life is Beautiful', 1997, 116, 'Italian', 'A father shields his son from the Holocaust.'),
50('Das Boot', 1981, 149, 'German', 'A German submarine crew in WWII.'),
51('Run Lola Run', 1998, 81, 'German', 'A woman races to save her boyfriend.'),
52('Crouching Tiger Hidden Dragon',2000, 120, 'Chinese', 'Warriors battle over a stolen sword.'),
53('Hero', 2002, 99, 'Chinese', 'An assassin tells the story of his mission.'),
54('Lagaan', 2001, 224, 'Hindi', 'Villagers challenge colonial rulers to cricket.'),
55('3 Idiots', 2009, 170, 'Hindi', 'Three friends navigate engineering college.'),
56('No Country for Old Men', 2007, 122, 'English', 'A hunter stumbles upon drug money.'),
57('There Will Be Blood', 2007, 158, 'English', 'An oilman''s obsession destroys everything.'),
58('Eternal Sunshine of the Spotless Mind', 2004, 108, 'English', 'A couple erases memories of each other.'),
59('Requiem for a Dream', 2000, 102, 'English', 'Four people spiral into addiction.'),
60('Black Swan', 2010, 108, 'English', 'A ballerina descends into madness.'),
61('Birdman', 2014, 119, 'English', 'A faded superhero actor seeks redemption.'),
62('12 Years a Slave', 2013, 134, 'English', 'A free Black man is enslaved.'),
63('The Wolf of Wall Street', 2013, 180, 'English', 'A stockbroker''s rise and fall.'),
64('Django Unchained', 2012, 165, 'English', 'A freed slave hunts down his wife.'),
65('Inglourious Basterds', 2009, 153, 'English', 'A plot to assassinate Nazi leaders.'),
66('Once Upon a Time in Hollywood', 2019, 161, 'English', 'An actor navigates 1960s Hollywood.'),
67('Joker', 2019, 122, 'English', 'The origin of Batman''s greatest enemy.'),
68('1917', 2019, 119, 'English', 'Two soldiers cross enemy lines in WWI.'),
69('Dunkirk', 2017, 106, 'English', 'The evacuation of Dunkirk in WWII.'),
70('Arrival', 2016, 116, 'English', 'A linguist deciphers alien language.'),
71('Ex Machina', 2014, 108, 'English', 'A programmer tests an AI robot.'),
72('Her', 2013, 126, 'English', 'A man falls in love with an AI.'),
73('Blade Runner 2049', 2017, 164, 'English', 'A blade runner uncovers a secret.'),
74('The Shape of Water', 2017, 123, 'English', 'A mute woman falls for a sea creature.'),
75('Three Billboards Outside Ebbing', 2017, 115, 'English', 'A mother challenges police inaction.'),
76('Get Out', 2017, 104, 'English', 'A Black man uncovers a terrifying secret.'),
77('Hereditary', 2018, 127, 'English', 'A family unravels dark secrets after a death.'),
78('Midsommar', 2019, 148, 'English', 'A couple travels to a Swedish midsummer festival.'),
79('A Quiet Place', 2018, 90, 'English', 'A family survives in silence.'),
80('Bird Box', 2018, 124, 'English', 'Creatures drive people to madness.'),
81('The Witch', 2015, 92, 'English', 'A puritan family encounters evil in the woods.'),
82('It', 2017, 135, 'English', 'Children face a shapeshifting monster.'),
83('Doctor Strange', 2016, 115, 'English', 'A surgeon becomes a sorcerer.'),
84('Black Panther', 2018, 134, 'English', 'The king of Wakanda fights for his throne.'),
85('Avengers: Infinity War', 2018, 149, 'English', 'Heroes battle Thanos for the Infinity Stones.'),
86('Avengers: Endgame', 2019, 181, 'English', 'The Avengers reverse Thanos''s actions.'),
87('Spider-Man: Into the Spider-Verse', 2018, 117, 'English', 'Miles Morales becomes Spider-Man.'),
88('Coco', 2017, 105, 'English', 'A boy visits the Land of the Dead.'),
89('Soul', 2020, 100, 'English', 'A jazz musician journeys to the soul world.'),
90('Up', 2009, 96, 'English', 'An old man flies his house with balloons.'),
91('WALL-E', 2008, 98, 'English', 'A robot falls in love in a ruined Earth.'),
92('Toy Story', 1995, 81, 'English', 'Toys come alive when humans leave.'),
93('Finding Nemo', 2003, 100, 'English', 'A father searches for his lost son.'),
94('The Incredibles', 2004, 115, 'English', 'A family of superheroes saves the world.'),
95('Shrek', 2001, 90, 'English', 'An ogre rescues a princess.'),
96('Frozen', 2013, 102, 'English', 'A princess seeks her ice-powered sister.'),
97('Moana', 2016, 107, 'English', 'A girl sails to save her island.'),
98('Ratatouille', 2007, 111, 'English', 'A rat dreams of becoming a chef.'),
99('Inside Out', 2015, 95, 'English', 'Emotions guide a girl through change.'),
100('The Good the Bad and the Ugly', 1966, 178, 'Italian', 'Three men search for buried gold.'),
101('Once Upon a Time in the West', 1968, 165, 'Italian', 'A mysterious stranger seeks revenge.'),
102('Apocalypse Now', 1979, 147, 'English', 'A captain hunts a rogue colonel in Vietnam.'),
103('Full Metal Jacket', 1987, 116, 'English', 'Marines train for and fight in Vietnam.'),
104('Platoon', 1986, 120, 'English', 'A soldier''s moral struggle in Vietnam.'),
105('The Deer Hunter', 1978, 183, 'English', 'Friends cope after the Vietnam War.'),
106('One Flew Over the Cuckoos Nest', 1975, 133, 'English', 'A criminal feigns insanity in a mental ward.'),
107('Chinatown', 1974, 130, 'English', 'A private eye uncovers corruption in LA.'),
108('Taxi Driver', 1976, 114, 'English', 'A disturbed cab driver takes justice into his hands.'),
109('Raging Bull', 1980, 129, 'English', 'The rise and fall of boxer Jake LaMotta.'),
110('Scarface', 1983, 170, 'English', 'A Cuban refugee builds a drug empire.'),
111('The Departed', 2006, 151, 'English', 'Cops and criminals infiltrate each other.'),
112('Heat', 1995, 170, 'English', 'A detective hunts a master thief.'),
113('L.A. Confidential', 1997, 138, 'English', 'Corruption in 1950s Los Angeles.'),
114('Memento', 2000, 113, 'English', 'A man with no short-term memory hunts a killer.'),
115('Se7en', 1995, 127, 'English', 'Detectives track a serial killer.'),
116('Zodiac', 2007, 157, 'English', 'Journalists hunt the Zodiac Killer.'),
117('Prisoners', 2013, 153, 'English', 'A father searches for his kidnapped daughter.'),
118('Gone Girl', 2014, 149, 'English', 'A man becomes a suspect in his wife''s disappearance.'),
119('Nightcrawler', 2014, 117, 'English', 'A freelance crime journalist crosses lines.'),
120('Drive', 2011, 100, 'English', 'A stunt driver moonlights as a getaway driver.'),
121('Only God Forgives', 2013, 90, 'English', 'A drug smuggler seeks revenge in Bangkok.'),
122('Lost in Translation', 2003, 102, 'English', 'Two Americans bond in Tokyo.'),
123('The Virgin Suicides', 1999, 97, 'English', 'Neighbors recall five mysterious sisters.'),
124('Marie Antoinette', 2006, 123, 'English', 'The life of the famous French queen.'),
125('Almost Famous', 2000, 122, 'English', 'A teenager writes for Rolling Stone magazine.'),
126('Boogie Nights', 1997, 155, 'English', 'The rise and fall of a porn star.'),
127('Magnolia', 1999, 188, 'English', 'Interconnected stories in the San Fernando Valley.'),
128('Short Cuts', 1993, 187, 'English', 'Interwoven tales of suburban life.'),
129('Nashville', 1975, 160, 'English', 'Twenty-four characters converge in Nashville.'),
130('The Tree of Life', 2011, 139, 'English', 'A family''s journey through grace and nature.'),
131('Badlands', 1973, 94, 'English', 'A teenage girl and her killer boyfriend flee.'),
132('Days of Heaven', 1978, 95, 'English', 'A farm worker''s love triangle ends in tragedy.'),
133('Blue Velvet', 1986, 120, 'English', 'A student discovers a dark underworld.'),
134('Mulholland Drive', 2001, 147, 'English', 'An actress navigates a surreal Hollywood nightmare.'),
135('Eraserhead', 1977, 89, 'English', 'A man struggles with an unwanted child.'),
136('2001 A Space Odyssey', 1968, 149, 'English', 'Astronauts travel to Jupiter with a mysterious AI.'),
137('A Clockwork Orange', 1971, 136, 'English', 'A violent criminal undergoes aversion therapy.'),
138('The Shining', 1980, 146, 'English', 'A writer descends into madness in a hotel.'),
139('Eyes Wide Shut', 1999, 159, 'English', 'A doctor enters a secret erotic society.'),
140('Barry Lyndon', 1975, 185, 'English', 'An Irish rogue rises through 18th-century society.'),
141('Paths of Glory', 1957, 88, 'English', 'A general defends soldiers charged with cowardice.'),
142('Dr. Strangelove', 1964, 95, 'English', 'A general triggers a nuclear war.'),
143('Lolita', 1962, 153, 'English', 'A professor becomes obsessed with a teenager.'),
144('Spartacus', 1960, 197, 'English', 'A slave leads a revolt against Rome.'),
145('Casablanca', 1942, 102, 'English', 'A nightclub owner helps his former lover.'),
146('Citizen Kane', 1941, 119, 'English', 'The life of a media tycoon is investigated.'),
147('Sunset Boulevard', 1950, 110, 'English', 'A struggling screenwriter meets a faded star.'),
148('All About Eve', 1950, 138, 'English', 'An ambitious actress targets a Broadway star.'),
149('Singin in the Rain', 1952, 103, 'English', 'Hollywood transitions from silent films to talkies.'),
150('Rear Window', 1954, 112, 'English', 'A photographer suspects a neighbor of murder.'),
151('Vertigo', 1958, 128, 'English', 'A detective becomes obsessed with a mysterious woman.'),
152('North by Northwest', 1959, 136, 'English', 'A man is mistaken for a government agent.'),
153('Psycho', 1960, 109, 'English', 'A secretary encounters a disturbed motel owner.'),
154('The Birds', 1963, 119, 'English', 'A coastal town is attacked by birds.'),
155('Dial M for Murder', 1954, 105, 'English', 'A man plots to kill his wife.'),
156('Rope', 1948, 80, 'English', 'Two men hide a body at a dinner party.'),
157('Rebecca', 1940, 130, 'English', 'A woman is haunted by her husband''s first wife.'),
158('Notorious', 1946, 101, 'English', 'A spy falls for a woman used as a decoy.'),
159('Strangers on a Train', 1951, 101, 'English', 'Two strangers agree to swap murders.'),
160('To Catch a Thief', 1955, 106, 'English', 'A retired thief is suspected of new crimes.'),
161('The Wrong Man', 1956, 105, 'English', 'A musician is falsely accused of robbery.'),
162('The Man Who Knew Too Much', 1956, 120, 'English', 'A couple tries to prevent an assassination.'),
163('Lawrence of Arabia', 1962, 218, 'English', 'A British officer unites Arab tribes in WWI.'),
164('Ben-Hur', 1959, 212, 'English', 'A Jewish prince is betrayed and enslaved.'),
165('Gone with the Wind', 1939, 238, 'English', 'A Southern belle survives the Civil War.'),
166('Wizard of Oz', 1939, 101, 'English', 'A girl is swept away to a magical land.'),
167('It''s a Wonderful Life', 1946, 130, 'English', 'An angel shows a man what life would be without him.'),
168('Some Like It Hot', 1959, 121, 'English', 'Two musicians disguise themselves as women.'),
169('Double Indemnity', 1944, 107, 'English', 'An insurance agent helps a woman kill her husband.'),
170('The Maltese Falcon', 1941, 100, 'English', 'A detective searches for a priceless statuette.'),
171('On the Waterfront', 1954, 108, 'English', 'A dockworker stands up to a corrupt union.'),
172('12 Angry Men', 1957, 96, 'English', 'A juror questions a murder conviction.'),
173('The Bridge on the Drina', 1960, 132, 'Serbian', 'A historical epic spanning centuries.'),
174('Stalker', 1979, 162, 'Russian', 'A guide leads men through a mysterious Zone.'),
175('Solaris', 1972, 167, 'Russian', 'A psychologist investigates a space station.'),
176('Andrei Rublev', 1966, 205, 'Russian', 'The life of a medieval Russian icon painter.'),
177('The Mirror', 1975, 108, 'Russian', 'Memories and dreams intertwine.'),
178('Bicycle Thieves', 1948, 89, 'Italian', 'A man searches Rome for his stolen bicycle.'),
179('La Dolce Vita', 1960, 174, 'Italian', 'A journalist navigates Rome''s social scene.'),
180('8½', 1963, 138, 'Italian', 'A director struggles with creative block.'),
181('Rocco and His Brothers', 1960, 177, 'Italian', 'A family migrates to Milan with tragic results.'),
182('The Battle of Algiers', 1966, 121, 'Italian', 'The Algerian independence movement.'),
183('Breathless', 1960, 90, 'French', 'A French gangster goes on the run.'),
184('The 400 Blows', 1959, 99, 'French', 'A misunderstood boy escapes into the streets.'),
185('Jules and Jim', 1962, 105, 'French', 'Two friends love the same free-spirited woman.'),
186('Contempt', 1963, 103, 'French', 'A screenwriter watches his marriage crumble.'),
187('Pierrot le Fou', 1965, 110, 'French', 'A man leaves his wife for an old flame.'),
188('Vivre Sa Vie', 1962, 85, 'French', 'A woman drifts into prostitution in Paris.'),
189('Cleo from 5 to 7', 1962, 90, 'French', 'A singer awaits her medical diagnosis.'),
190('Hiroshima Mon Amour', 1959, 90, 'French', 'A French actress and a Japanese architect.'),
191('Last Year at Marienbad', 1961, 94, 'French', 'A man tries to convince a woman they met before.'),
192('The Wild Child', 1970, 83, 'French', 'A doctor civilizes a feral boy.'),
193('Shoah', 1985, 566, 'French', 'An epic Holocaust documentary.'),
194('Monsieur Hulot''s Holiday', 1953, 83, 'French', 'A clumsy man vacations at a seaside resort.'),
195('Mon Oncle', 1958, 116, 'French', 'A man contrasts modern and traditional life.'),
196('Traffic', 1971, 96, 'French', 'A car designer drives to an auto show.'),
197('The Umbrellas of Cherbourg', 1964, 91, 'French', 'A love story told entirely in song.'),
198('A Man and a Woman', 1966, 102, 'French', 'Two widowed parents fall in love.'),
199('Z', 1969, 127, 'French', 'The assassination of a Greek pacifist.'),
200('The Conformist', 1970, 108, 'Italian', 'A fascist agent is ordered to kill his mentor.'),
201('Investigation of a Citizen Above Suspicion', 1970, 115, 'Italian', 'A police official kills his mistress.'),
202('Aguirre the Wrath of God', 1972, 93, 'German', 'A mad conquistador searches for El Dorado.'),
203('Fitzcarraldo', 1982, 158, 'German', 'A dreamer hauls a ship over a mountain.'),
204('Nosferatu', 1922, 94, 'German', 'A vampire stalks a young man''s wife.'),
205('Metropolis', 1927, 153, 'German', 'Workers rebel in a futuristic city.'),
206('The Cabinet of Dr Caligari', 1920, 76, 'German', 'A hypnotist uses a sleepwalker to commit murders.'),
207('M', 1931, 117, 'German', 'A child murderer is hunted by criminals.'),
208('The Blue Angel', 1930, 108, 'German', 'A professor is ruined by a cabaret singer.'),
209('Wings of Desire', 1987, 128, 'German', 'An angel wishes to become human in Berlin.'),
210('Paris Texas', 1984, 147, 'German', 'A man wanders out of the Texas desert.'),
211('Rashomon', 1950, 88, 'Japanese', 'Four witnesses give differing accounts of a crime.'),
212('Seven Samurai', 1954, 207, 'Japanese', 'Samurai defend a village from bandits.'),
213('Ikiru', 1952, 143, 'Japanese', 'A bureaucrat faces his mortality.'),
214('Yojimbo', 1961, 110, 'Japanese', 'A samurai plays two gangs against each other.'),
215('Sanjuro', 1962, 96, 'Japanese', 'A samurai helps young officials fight corruption.'),
216('High and Low', 1963, 143, 'Japanese', 'A businessman must choose between wealth and a life.'),
217('The Hidden Fortress', 1958, 139, 'Japanese', 'Two peasants escort a princess through enemy territory.'),
218('Ran', 1985, 162, 'Japanese', 'An aging warlord divides his kingdom among his sons.'),
219('Kagemusha', 1980, 180, 'Japanese', 'A thief impersonates a dead warlord.'),
220('Dersu Uzala', 1975, 141, 'Japanese', 'A soldier befriends a Mongolian hunter.'),
221('Akira', 1988, 124, 'Japanese', 'A biker gang triggers a psychic catastrophe.'),
222('Ghost in the Shell', 1995, 82, 'Japanese', 'A cyborg cop hunts a mysterious hacker.'),
223('Princess Mononoke', 1997, 134, 'Japanese', 'A prince mediates between humans and forest gods.'),
224('Howls Moving Castle', 2004, 119, 'Japanese', 'A girl is cursed to live as an old woman.'),
225('My Neighbor Totoro', 1988, 86, 'Japanese', 'Two sisters befriend forest spirits.'),
226('Castle in the Sky', 1986, 124, 'Japanese', 'A boy and girl search for a floating city.'),
227('Nausicaa of the Valley of the Wind', 1984, 117, 'Japanese', 'A princess fights to save her world.'),
228('Grave of the Fireflies', 1988, 89, 'Japanese', 'Two siblings struggle to survive in wartime Japan.'),
229('Porco Rosso', 1992, 94, 'Japanese', 'A WWI ace is cursed to look like a pig.'),
230('The Wind Rises', 2013, 126, 'Japanese', 'A young man dreams of designing airplanes.'),
231('When Marnie Was There', 2014, 103, 'Japanese', 'A girl befriends a mysterious girl in a mansion.'),
232('Wolf Children', 2012, 117, 'Japanese', 'A woman raises her half-wolf children alone.'),
233('The Girl Who Leapt Through Time', 2006, 98, 'Japanese', 'A teenager discovers she can leap through time.'),
234('A Silent Voice', 2016, 130, 'Japanese', 'A bully seeks redemption from a deaf girl.'),
235('In This Corner of the World', 2016, 129, 'Japanese', 'A woman copes with WWII in Hiroshima.'),
236('Sword of the Stranger', 2007, 103, 'Japanese', 'A wandering swordsman protects a young boy.'),
237('Paprika', 2006, 90, 'Japanese', 'A therapist enters patients'' dreams.'),
238('Perfect Blue', 1997, 81, 'Japanese', 'A pop star''s reality blurs with fantasy.'),
239('Millennium Actress', 2001, 87, 'Japanese', 'A documentary filmmaker explores an actress''s life.'),
240('Tokyo Godfathers', 2003, 92, 'Japanese', 'Three homeless people care for an abandoned baby.'),
241('Burning', 2018, 148, 'Korean', 'A young man suspects his new friend of a crime.'),
242('The Handmaiden', 2016, 145, 'Korean', 'A con man targets a Japanese heiress.'),
243('Memories of Murder', 2003, 132, 'Korean', 'Detectives investigate Korea''s first serial killings.'),
244('Mother', 2009, 129, 'Korean', 'A mother defends her son against a murder charge.'),
245('A Bittersweet Life', 2005, 120, 'Korean', 'A mob enforcer turns against his boss.'),
246('I Saw the Devil', 2010, 144, 'Korean', 'An agent hunts the man who killed his fiancee.'),
247('The Wailing', 2016, 156, 'Korean', 'Strange deaths plague a village after a stranger arrives.'),
248('Train to Busan', 2016, 118, 'Korean', 'Passengers fight zombies on a speeding train.'),
249('A Tale of Two Sisters', 2003, 115, 'Korean', 'Sisters return home to their stepmother.'),
250('Joint Security Area', 2000, 110, 'Korean', 'Soldiers investigate a shooting at the DMZ.'),
251('Spring Summer Fall Winter and Spring', 2003, 103, 'Korean', 'A monk''s life cycles through the seasons.'),
252('Oasis', 2002, 132, 'Korean', 'An ex-convict falls for a woman with cerebral palsy.'),
253('Poetry', 2010, 139, 'Korean', 'An elderly woman writes poetry while caring for her grandson.'),
254('Pieta', 2012, 104, 'Korean', 'A loan shark is visited by a woman claiming to be his mother.'),
255('The Host', 2006, 120, 'Korean', 'A family fights a river monster that took their daughter.'),
256('Snowpiercer', 2013, 126, 'Korean', 'Survivors of a new ice age live on a perpetual train.'),
257('Okja', 2017, 120, 'Korean', 'A girl tries to save her giant animal friend.'),
258('The Map of Tiny Perfect Things', 2021, 99, 'English', 'Two teens are stuck in an infinite time loop.'),
259('Palm Springs', 2020, 90, 'English', 'Two strangers are trapped in a time loop.'),
260('Tenet', 2020, 150, 'English', 'A secret agent manipulates the flow of time.'),
261('The Father', 2020, 97, 'English', 'An aging man struggles with dementia.'),
262('Minari', 2020, 115, 'Korean', 'A Korean family starts a farm in Arkansas.'),
263('Nomadland', 2020, 108, 'English', 'A woman travels the American West as a nomad.'),
264('The Trial of the Chicago 7', 2020, 130, 'English', 'Seven men are tried for the 1968 Democratic Convention riots.'),
265('Sound of Metal', 2020, 120, 'English', 'A drummer loses his hearing.'),
266('Ma Rainey''s Black Bottom', 2020, 94, 'English', 'Tensions rise during a legendary blues singer''s recording session.'),
267('Judas and the Black Messiah', 2021, 126, 'English', 'An informant infiltrates the Black Panther Party.'),
268('The Power of the Dog', 2021, 126, 'English', 'A rancher torments his brother''s new wife.'),
269('Drive My Car', 2021, 179, 'Japanese', 'A theater director processes grief through work.'),
270('The Worst Person in the World', 2021, 128, 'Norwegian', 'A woman navigates love and identity in Oslo.'),
271('Titane', 2021, 108, 'French', 'A woman with a titanium plate in her skull commits crimes.'),
272('Compartment No. 6', 2021, 107, 'Finnish', 'Two strangers share a train compartment.'),
273('Petite Maman', 2021, 72, 'French', 'A girl meets a child who might be her mother.'),
274('Memoria', 2021, 136, 'Thai', 'A woman investigates a mysterious sound in her head.'),
275('Dune', 2021, 155, 'English', 'A noble family controls a desert planet.'),
276('The Batman', 2022, 176, 'English', 'Batman investigates corruption in Gotham.'),
277('Everything Everywhere All at Once', 2022, 139, 'English', 'A woman explores parallel universes.'),
278('The Banshees of Inisherin', 2022, 114, 'English', 'A man''s friendship is abruptly ended by his friend.'),
279('Tar', 2022, 158, 'English', 'A renowned conductor faces a reckoning.'),
280('All Quiet on the Western Front', 2022, 148, 'German', 'A young German soldier experiences WWI.'),
281('Decision to Leave', 2022, 138, 'Korean', 'A detective becomes obsessed with a murder suspect.'),
282('Aftersun', 2022, 102, 'English', 'A daughter reflects on a holiday with her father.'),
283('The Fabelmans', 2022, 151, 'English', 'A young man discovers a truth about his family through filmmaking.'),
284('Women Talking', 2022, 104, 'English', 'Women in an isolated colony deliberate their future.'),
285('Oppenheimer', 2023, 180, 'English', 'The story of the atomic bomb''s creation.'),
286('Barbie', 2023, 114, 'English', 'Barbie goes on a journey of self-discovery.'),
287('Past Lives', 2023, 106, 'English', 'Childhood sweethearts reconnect years later.'),
288('Killers of the Flower Moon', 2023, 206, 'English', 'FBI investigates murders of Osage Nation members.'),
289('Anatomy of a Fall', 2023, 152, 'French', 'A woman is suspected of murdering her husband.'),
290('The Zone of Interest', 2023, 105, 'German', 'A Nazi commandant''s family lives beside Auschwitz.'),
291('Poor Things', 2023, 141, 'English', 'A woman brought back to life explores the world.'),
292('Saltburn', 2023, 131, 'English', 'A student becomes obsessed with his classmate''s family.'),
293('Society of the Snow', 2023, 144, 'Spanish', 'Survivors of a plane crash in the Andes.'),
294('Monster', 2023, 126, 'Japanese', 'A disaster seen from multiple perspectives.'),
295('The Holdovers', 2023, 133, 'English', 'A teacher and student bond over the holidays.'),
296('May December', 2023, 117, 'English', 'An actress researches a woman whose past is controversial.'),
297('Priscilla', 2023, 113, 'English', 'The story of Elvis Presley''s wife.'),
298('American Fiction', 2023, 117, 'English', 'A frustrated novelist accidentally writes a bestseller.'),
299('Ferrari', 2023, 130, 'English', 'Enzo Ferrari''s turbulent 1957 season.'),
300('The Substance', 2024, 140, 'English', 'A woman uses a substance to create a perfect version of herself.'),
301('Conclave', 2024, 120, 'English', 'Cardinals gather to elect a new pope.'),
302('The Brutalist', 2024, 215, 'English', 'A Hungarian architect rebuilds his life in America.'),
303('Emilia Perez', 2024, 130, 'French', 'A cartel boss undergoes a transformation.'),
304('Anora', 2024, 139, 'English', 'A young woman marries the son of a Russian oligarch.'),
305('Nosferatu Remake', 2024, 132, 'English', 'A reimagining of the classic vampire tale.'),
306('A Real Pain', 2024, 89, 'English', 'Two cousins travel to Poland to honor their grandmother.'),
307('Nickel Boys', 2024, 140, 'English', 'Two boys survive a brutal reform school in 1960s Florida.'),
308('I Saw the TV Glow', 2024, 100, 'English', 'Two teenagers bond over a mysterious TV show.'),
309('Civil War', 2024, 109, 'English', 'Journalists travel through a war-torn America.'),
310('Alien: Romulus', 2024, 119, 'English', 'Young colonists face a terrifying encounter in space.'),
311('Kingdom of the Planet of the Apes', 2024, 145, 'English', 'A new ape leader builds an empire.'),
312('Furiosa', 2024, 148, 'English', 'The origin story of Furiosa in the wasteland.'),
313('Dune Part Two', 2024, 167, 'English', 'Paul Atreides unites with the Fremen against the Harkonnens.'),
314('Inside Out 2', 2024, 100, 'English', 'New emotions emerge in a teenager''s mind.'),
315('Deadpool and Wolverine', 2024, 128, 'English', 'Two mutants are forced on a dangerous mission.'),
316('Alien', 1979, 117, 'English', 'The crew of a spaceship encounters a deadly alien.'),
317('Aliens', 1986, 137, 'English', 'Marines battle a colony of aliens.'),
318('The Terminator', 1984, 107, 'English', 'A cyborg is sent back in time to kill a woman.'),
319('Terminator 2 Judgment Day', 1991, 137, 'English', 'A reprogrammed Terminator protects a boy.'),
320('RoboCop', 1987, 102, 'English', 'A murdered cop is revived as a cyborg policeman.'),
321('Total Recall', 1990, 113, 'English', 'A man discovers his memories are implanted.'),
322('Basic Instinct', 1992, 127, 'English', 'A detective investigates a seductive suspect.'),
323('Speed', 1994, 94, 'English', 'A bus must stay above 50 mph or explode.'),
324('Point Break', 1991, 122, 'English', 'An FBI agent infiltrates a gang of surfer bank robbers.'),
325('Con Air', 1997, 115, 'English', 'A parolee must stop convicts who hijack his flight.'),
326('Face Off', 1997, 138, 'English', 'A cop and criminal literally swap faces.'),
327('The Rock', 1996, 136, 'English', 'Terrorists seize Alcatraz and threaten San Francisco.'),
328('Armageddon', 1998, 151, 'English', 'Drillers are sent to destroy an asteroid.'),
329('Independence Day', 1996, 145, 'English', 'Aliens invade Earth on July 4th.'),
330('Men in Black', 1997, 98, 'English', 'Agents police alien activity on Earth.'),
331('The Truman Show', 1998, 103, 'English', 'A man discovers his life is a TV show.'),
332('Pleasantville', 1998, 124, 'English', 'Siblings are transported into a 1950s TV show.'),
333('American Beauty', 1999, 122, 'English', 'A suburban man has a midlife crisis.'),
334('American History X', 1998, 119, 'English', 'A reformed neo-Nazi tries to help his brother.'),
335('The Sixth Sense', 1999, 107, 'English', 'A boy who sees dead people seeks help from a psychologist.'),
336('Unbreakable', 2000, 106, 'English', 'A man discovers he may be a superhero.'),
337('Signs', 2002, 106, 'English', 'A family discovers crop circles on their farm.'),
338('The Village', 2004, 108, 'English', 'A 19th-century village is surrounded by frightening creatures.'),
339('Split', 2016, 117, 'English', 'Three girls are kidnapped by a man with 24 personalities.'),
340('Glass', 2019, 129, 'English', 'Three men with extraordinary abilities clash.'),
341('Old', 2021, 108, 'English', 'A family vacations on a beach that rapidly ages them.'),
342('Knock at the Cabin', 2023, 100, 'English', 'Strangers break into a family''s cabin with a dire ultimatum.'),
343('Shutter Island', 2010, 138, 'English', 'A US Marshal investigates a mental institution.'),
344('Cape Fear', 1991, 128, 'English', 'A lawyer is stalked by a man he once defended.'),
345('The Fugitive', 1993, 130, 'English', 'A man hunts the one-armed man who killed his wife.'),
346('Air Force One', 1997, 124, 'English', 'The president fights back against hijackers.'),
347('The Negotiator', 1998, 139, 'English', 'A hostage negotiator takes hostages himself.'),
348('Collateral', 2004, 120, 'English', 'A cab driver is taken hostage by a hitman.'),
349('Michael Clayton', 2007, 119, 'English', 'A fixer uncovers corporate malfeasance.'),
350('Syriana', 2005, 128, 'English', 'The global politics of the oil industry.'),
351('Babel', 2006, 143, 'English', 'Interconnected stories across four countries.'),
352('Crash', 2004, 112, 'English', 'Racial tensions collide in Los Angeles.'),
353('Million Dollar Baby', 2004, 132, 'English', 'A trainer helps a determined woman become a boxer.'),
354('Mystic River', 2003, 138, 'English', 'Three childhood friends are reunited by tragedy.'),
355('Blood Diamond', 2006, 143, 'English', 'A smuggler and a fisherman search for a rare diamond.'),
356('The Last King of Scotland', 2006, 123, 'English', 'A doctor becomes Idi Amin''s personal physician.'),
357('Hotel Rwanda', 2004, 122, 'English', 'A hotel manager shelters Tutsi refugees during the genocide.'),
358('Sophie''s Choice', 1982, 150, 'English', 'A Holocaust survivor faces an unimaginable choice.'),
359('The Pianist', 2002, 150, 'English', 'A Polish pianist survives the Holocaust.'),
360('Son of Saul', 2015, 107, 'Hungarian','A Sonderkommando tries to give a boy a proper burial.'),
361('Ida', 2013, 82, 'Polish', 'A novice nun discovers her Jewish past.'),
362('Cold War', 2018, 88, 'Polish', 'A love story across Cold War Europe.'),
363('Katyn', 2007, 122, 'Polish', 'The aftermath of the Katyn massacre.'),
364('A Separation', 2011, 123, 'Persian', 'A couple''s separation has wide-reaching consequences.'),
365('The Salesman', 2016, 125, 'Persian', 'A couple is affected by an incident in their new home.'),
366('About Elly', 2009, 119, 'Persian', 'A woman disappears during a weekend trip.'),
367('Capernaum', 2018, 126, 'Arabic', 'A boy sues his parents for giving him life.'),
368('The Square', 2017, 151, 'Swedish', 'An art curator faces a public relations crisis.'),
369('Force Majeure', 2014, 120, 'Swedish', 'A man''s cowardice during an avalanche has consequences.'),
370('The Hunt', 2012, 115, 'Danish', 'A teacher is falsely accused of child abuse.'),
371('Melancholia', 2011, 136, 'Danish', 'Two sisters cope as a rogue planet approaches Earth.'),
372('Dancer in the Dark', 2000, 140, 'Danish', 'A factory worker faces a tragic destiny.'),
373('Breaking the Waves', 1996, 159, 'Danish', 'A woman sacrifices herself for her paralyzed husband.'),
374('The Celebration', 1998, 105, 'Danish', 'A family''s secrets emerge at a birthday dinner.'),
375('Let the Right One In', 2008, 115, 'Swedish', 'A bullied boy befriends a vampire.'),
376('The Girl with the Dragon Tattoo', 2009, 152, 'Swedish', 'A journalist and hacker investigate a disappearance.'),
377('Wild Strawberries', 1957, 91, 'Swedish', 'An elderly professor reflects on his life.'),
378('The Seventh Seal', 1957, 96, 'Swedish', 'A knight plays chess with Death.'),
379('Persona', 1966, 83, 'Swedish', 'A nurse cares for a silent actress.'),
380('Scenes from a Marriage', 1974, 168, 'Swedish', 'A couple''s marriage gradually dissolves.'),
381('Fanny and Alexander', 1982, 188, 'Swedish', 'A Swedish family''s life over three decades.'),
382('The Emigrants', 1971, 191, 'Swedish', 'Swedish families emigrate to America.'),
383('Hour of the Wolf', 1968, 90, 'Swedish', 'An artist is haunted by demons on an island.'),
384('Through a Glass Darkly', 1961, 89, 'Swedish', 'A woman''s schizophrenia tears a family apart.'),
385('Amarcord', 1973, 123, 'Italian', 'Memories of a small Italian town in the 1930s.'),
386('Satyricon', 1969, 138, 'Italian', 'Two young men seek pleasure in ancient Rome.'),
387('The Leopard', 1963, 186, 'Italian', 'A Sicilian aristocrat navigates social change.'),
388('Salo', 1975, 117, 'Italian', 'Fascists subject teenagers to extreme depravity.'),
389('The Gospel According to St Matthew', 1964, 137, 'Italian', 'The life of Jesus told in a realist style.'),
390('Teorema', 1968, 98, 'Italian', 'A mysterious stranger disrupts a bourgeois family.'),
391('Accattone', 1961, 120, 'Italian', 'A pimp struggles to survive on the streets of Rome.'),
392('Red Desert', 1964, 120, 'Italian', 'A woman struggles with alienation in industrial Italy.'),
393('Blow-Up', 1966, 111, 'English', 'A photographer discovers evidence of murder in a photo.'),
394('The Passenger', 1975, 126, 'English', 'A journalist assumes a dead man''s identity.'),
395('Zabriskie Point', 1970, 112, 'English', 'Two young Americans escape to the desert.'),
396('Once Upon a Time in America', 1984, 229, 'English', 'The lives of Jewish gangsters in New York.'),
397('Stagecoach', 1939, 96, 'English', 'Disparate passengers travel through Apache territory.'),
398('High Noon', 1952, 85, 'English', 'A marshal faces outlaws alone on his wedding day.'),
399('Shane', 1953, 118, 'English', 'A retired gunslinger helps a farming family.'),
400('The Searchers', 1956, 119, 'English', 'A Civil War veteran searches years for his niece.'),
401('Rio Bravo', 1959, 141, 'English', 'A sheriff and his allies hold a killer in jail.'),
402('True Grit', 1969, 128, 'English', 'A young girl hires a marshal to avenge her father.'),
403('The Wild Bunch', 1969, 145, 'English', 'Aging outlaws plan one last heist in Mexico.'),
404('Butch Cassidy and the Sundance Kid', 1969, 110, 'English', 'Two outlaws flee to Bolivia.'),
405('McCabe and Mrs Miller', 1971, 121, 'English', 'A gambler and prostitute build a frontier town.'),
406('Pat Garrett and Billy the Kid', 1973, 106, 'English', 'A lawman hunts his old friend.'),
407('Unforgiven', 1992, 131, 'English', 'A retired outlaw takes one last job.');
408-----внесување во табелата Movie со вештачки филмови
409INSERT INTO Movie (title, release_year, duration, language, description)
410SELECT
411
412 (
413 arr1[1 + floor(random() * array_length(arr1, 1))::int]
414 || ' ' ||
415 arr2[1 + floor(random() * array_length(arr2, 1))::int]
416 ||
417 CASE WHEN random() < 0.4 THEN
418 ' ' || arr3[1 + floor(random() * array_length(arr3, 1))::int]
419 ELSE '' END
420 ) AS title,
421
422 1970 + (random() * 55)::INT,
423
424 75 + (random() * 120)::INT,
425
426 arr4[1 + floor(random() * array_length(arr4, 1))::int],
427
428 arr5[1 + floor(random() * array_length(arr5, 1))::int]
429
430FROM generate_series(1, 4500),
431
432LATERAL (
433 SELECT
434 ARRAY[
435 'The','A','Last','Dark','Silent','Lost','Broken','Shadow','Blood','Iron',
436 'Golden','Crimson','Hollow','Forgotten','Hidden','Eternal','Fallen','Rising',
437 'Black','White','Red','Cold','Dead','Final','Secret','Burning','Frozen',
438 'Shattered','Twisted','Pale','Distant','Empty','Fading','Burning','Sacred',
439 'Haunted','Stolen','Naked','Savage','Ancient','Electric','Neon','Glass',
440 'Stone','Steel','Silver','Wild','Quiet','Loud','Bitter','Sweet'
441 ] AS arr1,
442
443 ARRAY[
444 'Knight','Storm','Garden','River','Mirror','Road','Sky','Wolf','Star','Moon',
445 'Sun','Fire','Rain','Wind','Ocean','Mountain','Forest','Desert','City','Island',
446 'Night','Dawn','Dusk','Dream','Shadow','Echo','Flame','Tide','Ghost','King',
447 'Queen','Prince','Warrior','Hunter','Stranger','Child','Angel','Demon','Beast',
448 'Tiger','Dragon','Phoenix','Falcon','Raven','Serpent','Crow','Fox','Bear','Lion',
449 'Horizon','Abyss','Void','Silence','Memory','Promise','Lie','Truth','War','Peace',
450 'Love','Hate','Hope','Fear','Fate','Soul','Heart','Mind','Blood','Bone',
451 'Bridge','Tower','Gate','Wall','Path','Trail','Shore','Cliff','Valley','Peak',
452 'Throne','Crown','Sword','Shield','Arrow','Chain','Key','Door','Window','Room',
453 'House','Street','District','Empire','Kingdom','Republic','Nation','World','Realm'
454 ] AS arr2,
455
456 ARRAY[
457 'of Destiny','of Shadows','of Silence','of Fire','of Ice','of Steel',
458 'of Lies','of Hope','of Sorrow','of War','of the Lost','of the Fallen',
459 'of the Dead','of the Brave','of the Damned','of the Ages','Rising',
460 'Reborn','Unleashed','Forsaken','Betrayed','Redeemed','Unbroken',
461 'Forever','Never Again','Once More','Part II','Returns','Begins',
462 'Strikes Back','Awakens','Endures','Survives','Prevails','Falls'
463 ] AS arr3,
464
465 ARRAY[
466 'English','English','English','English','English',
467 'Spanish','French','German','Italian','Japanese',
468 'Korean','Chinese','Hindi','Macedonian','Portuguese',
469 'Russian','Turkish','Arabic','Swedish','Danish'
470 ] AS arr4,
471
472 ARRAY[
473 'An epic tale of survival and redemption.',
474 'A gripping story of love and betrayal.',
475 'Two rivals face each other in a final showdown.',
476 'A journey through darkness toward the light.',
477 'Secrets buried for decades come to light.',
478 'A family torn apart must find their way back.',
479 'One man stands between order and chaos.',
480 'The truth is more terrifying than fiction.',
481 'When the past catches up, nothing is safe.',
482 'A story of courage in the face of impossible odds.',
483 'Love and duty collide in an unforgiving world.',
484 'The line between good and evil blurs.',
485 'A new threat emerges from the shadows.',
486 'Heroes are forged in the fires of adversity.',
487 'Nothing is as it seems in this twisted tale.',
488 'A race against time to prevent catastrophe.',
489 'The hunt begins and no one is safe.',
490 'Loyalties are tested when everything falls apart.',
491 'An unlikely hero rises to meet their destiny.',
492 'The world will never be the same again.'
493 ] AS arr5
494) t;
495-----внесување во табелата Genre_Movie
496INSERT INTO Genre_Movie (genre_id, movie_id)
497SELECT DISTINCT
498 1 + (random() * 19)::INT,
499 m
500FROM generate_series(1, 4893) m,
501 generate_series(1, 3)
502ON CONFLICT DO NOTHING;
503
504
505-----внесување во табелата Cinema
506INSERT INTO Cinema (name, city, address, phone, email)
507SELECT
508 'CinemaHouse ' || gs,
509 (ARRAY['Skopje','Bitola','Ohrid','Tetovo','Veles',
510 'Strumica','Kumanovo','Stip','Kocani','Gostivar'])[1 + (random()*9)::INT],
511 'Street ' || gs || ', No ' || (1 + (random()*200)::INT),
512 '+3897' || LPAD((1000000 + (random()*8999999)::INT)::TEXT, 7, '0'),
513 'cinema' || gs || '@example.com'
514FROM generate_series(1, 50) gs;
515
516
517-----внесување во табелата Hall
518INSERT INTO Hall (cinema_id, name, capacity)
519SELECT
520 c,
521 'Hall ' || h,
522 200
523FROM generate_series(1, 50) c,
524 generate_series(1, 4) h;
525
526-----внесување во табелата Seat_Type
527INSERT INTO Seat_Type (type, price)
528VALUES
529 ('Standard', 300),
530 ('VIP', 700),
531 ('Recliner', 500),
532 ('Couple', 600),
533 ('Disabled', 200);
534
535-----внесување во табелата Seat
536
537INSERT INTO Seat (hall_id, seat_type_id, seat_row, seat_number)
538SELECT
539 h,
540 1 + (random() * 4)::INT,
541 row_n,
542 seat_n
543FROM generate_series(1, 200) h,
544 generate_series(1, 20) row_n,
545 generate_series(1, 10) seat_n;
546
547
548-----внесување во табелата CinemaUser
549WITH data AS (
550 SELECT
551 gs,
552 CASE WHEN random() < 0.5 THEN 'F' ELSE 'M' END AS gender,
553
554 ARRAY[
555 'Ana','Marija','Elena','Sara','Maja','Lena','Tanja','Sanja','Milena','Irena',
556 'Kristina','Vesna','Natasa','Lidija','Gordana','Sonja','Biljana','Silvija','Daniela','Valentina',
557 'Emma','Olivia','Sophia','Isabella','Mia','Charlotte','Amelia','Harper','Evelyn','Abigail'
558 ] AS female_names,
559
560 ARRAY[
561 'Ivan','Nikola','Petar','Viktor','Darko','Boris','Goran','Zoran','Stefan','Dimitar',
562 'James','John','Robert','Michael','William','David','Richard','Joseph','Thomas','Charles'
563 ] AS male_names,
564
565 ARRAY[
566 'Stojanovska','Petrova','Nikolova','Ilieva','Popova','Kostova','Lazarova','Todorova',
567 'Smith','Johnson','Williams','Brown','Jones','Miller','Davis','Wilson','Anderson'
568 ] AS female_surnames,
569
570 ARRAY[
571 'Stojanovski','Petrov','Nikolov','Iliev','Popov','Kostov','Lazarov','Todorov',
572 'Smith','Johnson','Williams','Brown','Jones','Miller','Davis','Wilson','Anderson'
573 ] AS male_surnames
574 FROM generate_series(1, 100000) gs
575),
576
577picked AS (
578 SELECT
579 gs,
580 gender,
581
582 CASE WHEN gender = 'F'
583 THEN female_names[ceil(random()*array_length(female_names,1))::int]
584 ELSE male_names[ceil(random()*array_length(male_names,1))::int]
585 END AS first_name,
586
587 CASE WHEN gender = 'F'
588 THEN female_surnames[ceil(random()*array_length(female_surnames,1))::int]
589 ELSE male_surnames[ceil(random()*array_length(male_surnames,1))::int]
590 END AS last_name
591
592 FROM data
593)
594
595INSERT INTO CinemaUser (first_name, last_name, email, phone, registration_date)
596SELECT
597 first_name,
598 last_name,
599
600 LOWER(first_name) || '_' || LOWER(last_name) || '_' || gs::TEXT || '@mail.com',
601
602 '+3897' || LPAD((1000000 + (random()*8999999)::INT)::TEXT, 7, '0'),
603 DATE '2000-01-01' + (random() * 5000)::INT -- 2000–2013 pred rezervacii
604FROM picked;
605
606-----внесување во табелата Role
607INSERT INTO Role (role_name, description, base_salary)
608VALUES
609 ('Manager', 'Cinema manager', 60000),
610 ('Cashier', 'Ticket sales', 25000),
611 ('Projectionist', 'Movie projection', 30000),
612 ('Security', 'Security guard', 22000),
613 ('Cleaner', 'Cleaning staff', 18000),
614 ('Technician', 'Equipment maintenance', 35000),
615 ('Bartender', 'Bar service', 24000),
616 ('Supervisor', 'Floor supervisor', 40000),
617 ('Marketing', 'Marketing specialist', 38000),
618 ('Accountant', 'Financial accounting', 45000);
619
620
621-----внесување во табелата Employee
622WITH data AS (
623 SELECT
624 gs,
625 c,
626 e,
627 CASE WHEN random() < 0.5 THEN 'F' ELSE 'M' END AS gender,
628
629 ARRAY[
630 'Ana','Marija','Elena','Sara','Maja','Lena','Tanja','Sanja','Milena','Irena',
631 'Kristina','Vesna','Natasa','Lidija','Gordana','Sonja','Biljana','Silvija','Daniela','Valentina',
632 'Emma','Olivia','Sophia','Isabella','Mia','Charlotte','Amelia','Harper','Evelyn','Abigail'
633 ] AS female_names,
634
635 ARRAY[
636 'Ivan','Nikola','Petar','Viktor','Darko','Boris','Goran','Zoran','Stefan','Dimitar',
637 'James','John','Robert','Michael','William','David','Richard','Joseph','Thomas','Charles'
638 ] AS male_names,
639
640 ARRAY[
641 'Stojanovska','Petrova','Nikolova','Ilieva','Popova','Kostova','Lazarova','Todorova',
642 'Smith','Johnson','Williams','Brown','Jones','Miller','Davis','Wilson','Anderson'
643 ] AS female_surnames,
644
645 ARRAY[
646 'Stojanovski','Petrov','Nikolov','Iliev','Popov','Kostov','Lazarov','Todorov',
647 'Smith','Johnson','Williams','Brown','Jones','Miller','Davis','Wilson','Anderson'
648 ] AS male_surnames
649
650 FROM generate_series(1, 50) c,
651 generate_series(1, 10) e,
652 generate_series(1, 1) gs
653),
654
655picked AS (
656 SELECT
657 c,
658 e,
659 gender,
660
661 CASE WHEN gender = 'F' THEN
662 (SELECT x FROM unnest(female_names) x ORDER BY random() LIMIT 1)
663 ELSE
664 (SELECT x FROM unnest(male_names) x ORDER BY random() LIMIT 1)
665 END AS first_name,
666
667 CASE WHEN gender = 'F' THEN
668 (SELECT x FROM unnest(female_surnames) x ORDER BY random() LIMIT 1)
669 ELSE
670 (SELECT x FROM unnest(male_surnames) x ORDER BY random() LIMIT 1)
671 END AS last_name
672
673 FROM data
674)
675INSERT INTO Employee (cinema_id, first_name, last_name, phone, email, hire_date)
676SELECT
677 c,
678
679 first_name,
680 last_name,
681
682 '+3897' || LPAD((1000000 + (random()*8999999)::INT)::TEXT, 7, '0'),
683
684 LOWER(first_name) || '_' || LOWER(last_name) || '_' ||
685 (c * 10 + e)::TEXT || '@gmail.com',
686
687 DATE '1995-01-01' + (random() * 3650)::INT -- 1995–2005, пред резервациите
688
689FROM picked;
690
691
692-----внесување во табелата Employee_Role
693INSERT INTO Employee_Role (employee_id, role_id)
694SELECT
695 gs,
696 1 + (random() * 9)::INT
697FROM generate_series(1, 500) gs
698ON CONFLICT DO NOTHING;
699
700-----внесување во табелата Salary
701INSERT INTO Salary (employee_id, amount, payment_date)
702SELECT
703 er.employee_id,
704 (r.base_salary * (0.9 + random() * 0.2))::INT AS amount, -- base_salary ±10%
705 DATE '2000-01-01' + (random() * 9130)::INT AS payment_date
706FROM (
707 SELECT employee_id, role_id,
708 row_number() OVER (ORDER BY random()) AS rn
709 FROM Employee_Role
710) er
711JOIN Role r ON r.role_id = er.role_id
712CROSS JOIN generate_series(1, 200) gs
713WHERE er.rn <= 500
714ORDER BY random()
715LIMIT 100000;
716
717-----внесување во табелата PresentationRights
718INSERT INTO PresentationRights (movie_id, cinema_id, start_date, end_date)
719SELECT DISTINCT
720 1 + (random() * 4892)::INT,
721 1 + (random() * 49)::INT,
722 LEAST(d1, d2) AS start_date,
723 GREATEST(d1, d2) AS end_date
724FROM (
725 SELECT
726 DATE '2000-01-01' + (random() * 9130)::INT AS d1,
727 DATE '2000-01-01' + (random() * 9130)::INT AS d2
728 FROM generate_series(1, 15000)
729) dates
730ON CONFLICT DO NOTHING;
731
732-----внесување во табелата Showtime
733INSERT INTO Showtime (movie_id, hall_id, start_time, end_time, base_price)
734WITH
735slots AS (
736 SELECT
737 h.hall_id,
738 (DATE '2000-01-01' + ((gs - 1) || ' days')::INTERVAL)::DATE AS show_date,
739
740 (ARRAY[10,12,14,16,18,20])[1 + (random() * 5)::INT] AS start_hour
741 FROM generate_series(1, 9000) gs
742 CROSS JOIN Hall h
743),
744slots_with_movie AS (
745 SELECT
746 s.hall_id,
747 s.show_date,
748 s.start_hour,
749 1 + (floor(random() * 5000)::INT) AS movie_id
750 FROM slots s
751)
752SELECT
753 swm.movie_id,
754 swm.hall_id,
755 (swm.show_date::TIMESTAMP + (swm.start_hour || ' hours')::INTERVAL) AS start_time,
756 (swm.show_date::TIMESTAMP + (swm.start_hour || ' hours')::INTERVAL
757 + (m.duration * INTERVAL '1 minute')) AS end_time,
758 200 + (random() * 600)::INT AS base_price
759FROM slots_with_movie swm
760JOIN Movie m ON m.movie_id = swm.movie_id;
761
762
763-----внесување во табелата Expense
764INSERT INTO Expense (cinema_id, description, amount, expense_date)
765SELECT
766 1 + (random() * 49)::INT, -- cinema_id: 1–50
767 (ARRAY['Rent','Utilities','Maintenance','Marketing','Supplies',
768 'Equipment','Cleaning','Security','IT','Insurance'])[1+(random()*9)::INT],
769 5000 + (random() * 100000)::INT,
770 DATE '2000-01-01' + (random() * 9130)::INT
771FROM generate_series(1, 50000) gs;
772
773
774-----внесување во табелата Supplier
775INSERT INTO Supplier (name, phone, email, address)
776SELECT
777 'Supplier ' || gs,
778 '+38970' || LPAD((1000000 + (random()*8999999)::INT)::TEXT, 7, '0'),
779 'supplier' || gs || '@biz.com',
780 'Industrial Zone ' || gs
781FROM generate_series(1, 100) gs;
782
783-----внесување во табелата Product
784INSERT INTO Product (name, price, stock_quantity)
785SELECT
786 (ARRAY['Popcorn Large','Popcorn Medium','Cola 0.5L','Cola 1L','Water',
787 'Nachos','Hot Dog','Coffee','Tea','Juice',
788 'Candy Box','Ice Cream','Chips','Pretzel','Sandwich',
789 'Beer','Wine','Cocktail','Milkshake','Energy Drink'])[1+(random()*19)::INT]
790 || ' #' || gs,
791 50 + (random() * 450)::INT,
792 100 + (random() * 9900)::INT
793FROM generate_series(1, 200) gs;
794
795
796-----внесување во табелата Supply
797INSERT INTO Supply (product_id, supplier_id, expense_id, quantity, supply_date, price_per_unit)
798WITH supply_base AS (
799 SELECT
800 (1 + (random() * 199)::INT) AS product_id,
801 (1 + (random() * 99)::INT) AS supplier_id,
802 e.expense_id,
803 10 + (random() * 990)::INT AS quantity,
804 DATE '2000-01-01' + (random() * 9130)::INT AS supply_date,
805 20 + (random() * 300)::INT AS price_per_unit,
806 row_number() OVER (ORDER BY random()) AS rn
807 FROM Expense e
808)
809SELECT product_id, supplier_id, expense_id, quantity, supply_date, price_per_unit
810FROM supply_base
811WHERE rn <= 5000;
812
813-----внесување во табелата Reservation
814DO $$
815DECLARE
816 batch_size INT := 500000;
817 total INT := 10000000;
818 i INT := 0;
819BEGIN
820 WHILE i < total LOOP
821 INSERT INTO Reservation (user_id, showtime_id, employee_id, reservation_date, status)
822 WITH one_employee_per_showtime AS (
823 SELECT DISTINCT ON (st.showtime_id)
824 st.showtime_id,
825 st.start_time,
826 e.employee_id
827 FROM Showtime st
828 JOIN Hall h ON h.hall_id = st.hall_id
829 JOIN Employee e ON e.cinema_id = h.cinema_id
830 ORDER BY st.showtime_id, random()
831 ),
832 sampled AS (
833 SELECT
834 showtime_id,
835 start_time,
836 employee_id,
837 row_number() OVER (ORDER BY random()) AS rn
838 FROM one_employee_per_showtime
839 )
840 SELECT
841 1 + (random() * 99999)::INT AS user_id,
842 s.showtime_id,
843 s.employee_id,
844 (s.start_time::DATE - (1 + (random() * 29)::INT)) AS reservation_date,
845 (ARRAY['PENDING','CONFIRMED','CANCELLED']::statusReservation[])[1+(random()*2)::INT] AS status
846 FROM sampled s
847 WHERE s.rn <= batch_size
848 ON CONFLICT DO NOTHING;
849
850 i := i + batch_size;
851 RAISE NOTICE 'Reservation inserted: % / %', i, total;
852 END LOOP;
853END;
854$$;
855
856
857-----внесување во табелата Ticket
858DO $$
859DECLARE
860 batch_size INT := 100000;
861 total INT := 15000000;
862 i INT := 0;
863 inserted INT := 0;
864 offset_val INT := 0;
865BEGIN
866 WHILE i < total LOOP
867 INSERT INTO Ticket (showtime_id, seat_id, reservation_id, price, purchase_date)
868 WITH chosen_showtimes AS (
869 SELECT
870 st.showtime_id,
871 st.hall_id,
872 st.base_price,
873 st.start_time,
874 h.capacity
875 FROM Showtime st
876 JOIN Hall h ON h.hall_id = st.hall_id
877 ORDER BY st.showtime_id
878 LIMIT batch_size OFFSET offset_val
879 ),
880 res_per_showtime AS (
881 SELECT
882 r.reservation_id,
883 r.showtime_id,
884 cs.hall_id,
885 cs.capacity,
886 cs.base_price,
887 cs.start_time,
888 row_number() OVER (PARTITION BY r.showtime_id ORDER BY r.reservation_id) AS seat_rank
889 FROM chosen_showtimes cs
890 JOIN Reservation r ON r.showtime_id = cs.showtime_id
891 ),
892 capped_res AS (
893 SELECT reservation_id, showtime_id, hall_id, seat_rank, base_price, start_time
894 FROM res_per_showtime
895 WHERE seat_rank <= capacity
896 ),
897 seats_ranked AS (
898 SELECT
899 s.seat_id,
900 s.hall_id,
901 s.seat_type_id,
902 row_number() OVER (PARTITION BY s.hall_id ORDER BY s.seat_id) AS seat_rn
903 FROM Seat s
904 ),
905 final_assignment AS (
906 SELECT
907 cr.reservation_id,
908 cr.showtime_id,
909 sr.seat_id,
910 sr.seat_type_id,
911 cr.base_price,
912 cr.start_time
913 FROM capped_res cr
914 JOIN seats_ranked sr
915 ON sr.hall_id = cr.hall_id
916 AND sr.seat_rn = cr.seat_rank
917 )
918 SELECT
919 fa.showtime_id,
920 fa.seat_id,
921 fa.reservation_id,
922 (fa.base_price * CASE fa.seat_type_id
923 WHEN 1 THEN 1.0
924 WHEN 2 THEN 2.0
925 WHEN 3 THEN 1.5
926 WHEN 4 THEN 1.8
927 WHEN 5 THEN 0.7
928 ELSE 1.0
929 END)::INT AS price,
930 (fa.start_time::DATE - (1 + (random() * 29)::INT)) AS purchase_date
931 FROM final_assignment fa;
932
933 GET DIAGNOSTICS inserted = ROW_COUNT;
934 i := i + inserted;
935 offset_val := offset_val + batch_size;
936
937 IF offset_val >= 1800000 THEN
938 offset_val := 0;
939 END IF;
940
941 RAISE NOTICE 'Ticket inserted so far: %', i;
942 END LOOP;
943 RAISE NOTICE 'Total tickets inserted: %', i;
944END;
945$$;
946
947-----внесување во табелата Review
948DO $$
949DECLARE
950 batch_size INT := 500000;
951 total INT := 15000000;
952 i INT := 0;
953BEGIN
954 WHILE i < total LOOP
955 INSERT INTO Review (user_id, movie_id, rating, comment, review_date)
956 SELECT
957 1 + (random() * 99999)::INT, -- user_id: 1–100000
958 1 + (random() * 4892)::INT, -- movie_id: 1–5000 (сите филми)
959 1 + (random() * 9)::INT,
960 (ARRAY['Great!','Loved it','Boring','Amazing','Not bad',
961 'Terrible','Must watch','Waste of time','Brilliant','Average'])[1+(random()*9)::INT],
962 DATE '2000-01-01' + (random() * 8765)::INT
963 FROM generate_series(1, batch_size);
964 i := i + batch_size;
965 RAISE NOTICE 'Review inserted: % / %', i, total;
966 END LOOP;
967END;
968$$;
969
970-----внесување во табелата ReservationPayment
971DO $$
972DECLARE
973 batch_size INT := 500000;
974 total INT := 10000000;
975 i INT := 0;
976BEGIN
977 WHILE i < total LOOP
978 INSERT INTO ReservationPayment
979 (user_id, reservation_id, employee_id, amount, payment_date, payment_method)
980 WITH
981
982 ticket_totals AS (
983
984 SELECT
985 t.reservation_id,
986 SUM(t.price) AS total_ticket_price
987 FROM Ticket t
988 WHERE t.reservation_id > i
989 AND t.reservation_id <= i + batch_size
990 GROUP BY t.reservation_id
991 ),
992
993 batch AS (
994 SELECT DISTINCT ON (r.reservation_id)
995 r.reservation_id,
996 r.user_id,
997 r.reservation_date,
998 e.employee_id,
999 tt.total_ticket_price AS amount
1000 FROM ticket_totals tt
1001 JOIN Reservation r ON r.reservation_id = tt.reservation_id
1002 JOIN Showtime st ON st.showtime_id = r.showtime_id
1003 JOIN Hall h ON h.hall_id = st.hall_id
1004 JOIN Employee e ON e.cinema_id = h.cinema_id
1005 ORDER BY r.reservation_id, random()
1006 )
1007
1008 SELECT
1009 user_id,
1010 reservation_id,
1011 employee_id,
1012 amount,
1013 reservation_date + (random() * 3)::INT AS payment_date,
1014 (ARRAY['Cash','Credit Card','Debit Card','Online','Voucher'])
1015 [1+(random()*4)::INT] AS payment_method
1016 FROM batch;
1017
1018 i := i + batch_size;
1019 RAISE NOTICE 'ReservationPayment inserted: % / %', i, total;
1020 END LOOP;
1021END;
1022$$;
1023
1024-----внесување во табелата CinemaOrder
1025INSERT INTO CinemaOrder (user_id, employee_id, order_date, total_price, status)
1026WITH order_base AS (
1027 SELECT
1028 1 + (random() * 99999)::INT AS user_id,
1029 e.employee_id,
1030 row_number() OVER (ORDER BY random()) AS rn
1031 FROM Employee e
1032 CROSS JOIN generate_series(1, 3000) gs
1033)
1034SELECT
1035 user_id,
1036 employee_id,
1037 DATE '2000-01-01' + (random() * 8765)::INT AS order_date,
1038 0 AS total_price, -- ќе се UPDATE-ира подоцна
1039 (ARRAY['PREPARING','COMPLETED']::statusOrder[])[1+(random()*1)::INT] AS status
1040FROM order_base
1041WHERE rn <= 1500000;
1042
1043INSERT INTO Order_Product (order_id, product_id, quantity, price_at_order)
1044SELECT
1045 gs AS order_id,
1046 1 + (random() * 199)::INT AS product_id,
1047 1 + (random() * 5)::INT AS quantity,
1048 50 + (random() * 500)::INT AS price_at_order
1049FROM generate_series(1, 1500000) gs;
1050
1051-----внесување во табелата Order_Product
1052INSERT INTO Order_Product (order_id, product_id, quantity, price_at_order)
1053SELECT
1054 1 + (random() * 1499999)::INT AS order_id,
1055 1 + (random() * 199)::INT AS product_id,
1056 1 + (random() * 5)::INT AS quantity,
1057 50 + (random() * 500)::INT AS price_at_order
1058FROM generate_series(1, 3000000) gs;
1059
1060
1061UPDATE CinemaOrder co
1062SET total_price = sub.real_total
1063FROM (
1064 SELECT order_id, SUM(quantity * price_at_order) AS real_total
1065 FROM Order_Product
1066 GROUP BY order_id
1067) sub
1068WHERE co.order_id = sub.order_id;
1069
1070-----внесување во табелата OrderPayment
1071INSERT INTO OrderPayment (employee_id, order_id, user_id, amount, payment_date, payment_method)
1072SELECT
1073 co.employee_id,
1074 co.order_id,
1075 co.user_id,
1076 co.total_price AS amount, -- конзистентно со нарачката
1077 co.order_date + (random() * 3)::INT AS payment_date,
1078 (ARRAY['Cash','Credit Card','Debit Card','Online','Voucher'])[1+(random()*4)::INT] AS payment_method
1079FROM CinemaOrder co;
1080
1081
1082
1083UPDATE Reservation r
1084SET status = 'CONFIRMED'
1085WHERE EXISTS (
1086 SELECT 1 FROM Ticket t WHERE t.reservation_id = r.reservation_id
1087);
1088
1089UPDATE Reservation r
1090SET status = (ARRAY['PENDING','CANCELLED']::statusReservation[])[1+(random()*1)::INT]
1091WHERE NOT EXISTS (
1092 SELECT 1 FROM Ticket t WHERE t.reservation_id = r.reservation_id
1093);
1094-----внесување во табелата PresentationRights
1095INSERT INTO PresentationRights (movie_id, cinema_id, start_date, end_date)
1096SELECT DISTINCT
1097 s.movie_id,
1098 h.cinema_id,
1099 DATE '2000-01-01',
1100 DATE '2030-12-31'
1101FROM Showtime s
1102JOIN Hall h ON h.hall_id = s.hall_id
1103ON CONFLICT DO NOTHING;
1104
1105----------------------dopolnitelni filmovi za vo idnina dodadeni
1106INSERT INTO Showtime (movie_id, hall_id, start_time, end_time, base_price)
1107VALUES
1108-- CINEMA 1 (Hall 1-4)
1109(3, 1, '2026-07-25 10:00:00', '2026-07-25 12:32:00', 450), -- The Dark Knight
1110(8, 1, '2026-07-25 18:00:00', '2026-07-25 20:28:00', 500), -- Inception
1111(11, 2, '2026-07-26 14:00:00', '2026-07-26 16:49:00', 420), -- Interstellar
1112(26, 2, '2026-07-26 20:00:00', '2026-07-26 22:12:00', 400), -- Parasite
1113(52, 3, '2026-07-27 10:00:00', '2026-07-27 11:47:00', 380), -- Joker
1114(302, 3, '2026-07-27 18:00:00', '2026-07-27 20:47:00', 480), -- Dune Part Two
1115(9, 4, '2026-07-28 12:00:00', '2026-07-28 14:16:00', 430), -- The Matrix
1116(18, 4, '2026-07-28 20:00:00', '2026-07-28 22:23:00', 460), -- The Avengers
1117(27, 1, '2026-07-29 16:00:00', '2026-07-29 18:05:00', 410), -- Spirited Away
1118(71, 2, '2026-07-29 20:00:00', '2026-07-29 21:40:00', 350), -- Coco
1119
1120-- CINEMA 2 (Hall 5-8)
1121(53, 5, '2026-08-25 14:00:00', '2026-08-25 15:59:00', 400), -- 1917
1122(54, 5, '2026-08-25 20:00:00', '2026-08-25 21:46:00', 420), -- Dunkirk
1123(19, 6, '2026-08-26 10:00:00', '2026-08-26 12:42:00', 450), -- Avatar
1124(55, 6, '2026-08-26 18:00:00', '2026-08-26 19:56:00', 380), -- Arrival
1125(68, 7, '2026-08-27 14:00:00', '2026-08-27 16:14:00', 430), -- Black Panther
1126(69, 7, '2026-08-27 20:00:00', '2026-08-27 22:29:00', 500), -- Avengers: Infinity War
1127(70, 8, '2026-08-28 10:00:00', '2026-08-28 13:01:00', 520), -- Avengers: Endgame
1128(22, 8, '2026-08-28 18:00:00', '2026-08-28 19:47:00', 370), -- Whiplash
1129(56, 5, '2026-08-29 12:00:00', '2026-08-29 13:48:00', 390), -- Ex Machina
1130(57, 6, '2026-08-29 20:00:00', '2026-08-29 22:06:00', 410), -- Her
1131
1132-- CINEMA 3 (Hall 9-12)
1133(280, 9, '2026-07-25 16:00:00', '2026-07-25 18:15:00', 440), -- Oppenheimer
1134(281, 9, '2026-07-26 20:00:00', '2026-07-26 21:54:00', 420), -- Barbie
1135(282, 10, '2026-07-26 14:00:00', '2026-07-26 15:46:00', 390), -- Past Lives
1136(283, 10, '2026-07-27 18:00:00', '2026-07-27 21:26:00', 480), -- Killers of the Flower Moon
1137(285, 11, '2026-07-27 12:00:00', '2026-07-27 13:45:00', 400), -- The Zone of Interest
1138(286, 11, '2026-07-28 20:00:00', '2026-07-28 22:21:00', 430), -- Poor Things
1139(293, 12, '2026-07-28 14:00:00', '2026-07-28 16:28:00', 460), -- Dune
1140(291, 12, '2026-07-29 10:00:00', '2026-07-29 12:38:00', 450), -- Everything Everywhere All at Once
1141(292, 9, '2026-07-29 18:00:00', '2026-07-29 19:54:00', 410), -- The Banshees of Inisherin
1142(20, 10, '2026-07-30 20:00:00', '2026-07-30 22:19:00', 440); -- Fight Club
1143
1144------------------------Полнење на дополнително додадените филмови за во иднина
1145DO $$
1146DECLARE
1147 v_showtime RECORD;
1148 v_seat RECORD;
1149 v_reservation_id INT;
1150 v_seat_type_id INT;
1151 v_base_price INT;
1152 v_price INT;
1153 v_user_id INT;
1154 v_employee_id INT;
1155 v_fill_count INT;
1156 v_counter INT;
1157BEGIN
1158
1159 FOR v_showtime IN
1160 SELECT s.showtime_id, s.hall_id, s.base_price,
1161 h.cinema_id
1162 FROM Showtime s
1163 JOIN Hall h ON h.hall_id = s.hall_id
1164 ORDER BY s.showtime_id DESC
1165 LIMIT 30
1166 LOOP
1167 -- Случаен % пополнетост: 60–80% од 200 = 120–160 места
1168 v_fill_count := 120 + (random() * 40)::INT;
1169 v_counter := 0;
1170
1171 -- Земи вработен од истото кино
1172 SELECT employee_id INTO v_employee_id
1173 FROM Employee
1174 WHERE cinema_id = v_showtime.cinema_id
1175 ORDER BY random()
1176 LIMIT 1;
1177
1178 FOR v_seat IN
1179 SELECT se.seat_id, se.seat_type_id
1180 FROM Seat se
1181 WHERE se.hall_id = v_showtime.hall_id
1182 ORDER BY random()
1183 LIMIT v_fill_count
1184 LOOP
1185 EXIT WHEN v_counter >= v_fill_count;
1186
1187 -- Случаен корисник
1188 v_user_id := 1 + (random() * 99999)::INT;
1189
1190 -- Пресметај цена според тип седиште
1191 v_price := (v_showtime.base_price * CASE v_seat.seat_type_id
1192 WHEN 1 THEN 1.0
1193 WHEN 2 THEN 2.0
1194 WHEN 3 THEN 1.5
1195 WHEN 4 THEN 1.8
1196 WHEN 5 THEN 0.7
1197 ELSE 1.0
1198 END)::INT;
1199
1200 -- Резервација со статус CONFIRMED
1201 INSERT INTO Reservation (user_id, showtime_id, employee_id, reservation_date, status)
1202 VALUES (
1203 v_user_id,
1204 v_showtime.showtime_id,
1205 v_employee_id,
1206 CURRENT_DATE - (random() * 10)::INT,
1207 'CONFIRMED'
1208 )
1209 RETURNING reservation_id INTO v_reservation_id;
1210
1211 -- Билет
1212 INSERT INTO Ticket (showtime_id, seat_id, reservation_id, price, purchase_date)
1213 VALUES (
1214 v_showtime.showtime_id,
1215 v_seat.seat_id,
1216 v_reservation_id,
1217 v_price,
1218 CURRENT_DATE - (random() * 10)::INT
1219 );
1220
1221 -- Плаќање
1222 INSERT INTO ReservationPayment (
1223 user_id, reservation_id, employee_id,
1224 amount, payment_date, payment_method
1225 )
1226 VALUES (
1227 v_user_id,
1228 v_reservation_id,
1229 v_employee_id,
1230 v_price,
1231 CURRENT_DATE - (random() * 5)::INT,
1232 (ARRAY['Cash','Credit Card','Debit Card','Online','Voucher'])[1 + (random()*4)::INT]
1233 );
1234
1235 v_counter := v_counter + 1;
1236 END LOOP;
1237
1238 RAISE NOTICE 'Showtime %: % тикети внесени (сала %)',
1239 v_showtime.showtime_id, v_counter, v_showtime.hall_id;
1240 END LOOP;
1241END;
1242$$;
1243
1244
1245