· 7 years ago · Feb 04, 2019, 12:44 PM
1DROP DATABASE IF EXISTS video;
2CREATE DATABASE video DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
3USE video;
4
5CREATE TABLE actors(
6id int AUTO_INCREMENT,
7name varchar(30) not null,
8surname varchar(30) not null,
9photo_url text not null,
10bio text not null,
11primary key(id)
12);
13
14CREATE TABLE directors(
15id int AUTO_INCREMENT,
16name varchar(30) not null,
17surname varchar(30) not null,
18photo_url text not null,
19bio text not null,
20primary key(id)
21);
22
23CREATE TABLE movies(
24id int AUTO_INCREMENT,
25title varchar(30) not null,
26photo_url text not null,
27description text not null,
28runtime smallint not null,
29release_year year(4) not null,
30primary key(id)
31);
32
33CREATE TABLE series(
34id int AUTO_INCREMENT,
35title varchar(30) not null,
36photo_url text not null,
37description text not null,
38runtime smallint not null,
39release_year year(4) not null,
40primary key(id)
41);
42
43CREATE TABLE actors_movies(
44id_actors int not null,
45id_movies int not null,
46primary key(id_actors,id_movies),
47foreign key(id_actors) REFERENCES actors(id) ON UPDATE CASCADE ON DELETE CASCADE,
48foreign key(id_movies) REFERENCES movies(id) ON UPDATE CASCADE ON DELETE CASCADE
49);
50
51CREATE TABLE directors_movies(
52id_directors int not null,
53id_movies int not null,
54primary key(id_directors,id_movies),
55foreign key(id_directors) REFERENCES directors(id) ON UPDATE CASCADE ON DELETE CASCADE,
56foreign key(id_movies) REFERENCES movies(id) ON UPDATE CASCADE ON DELETE CASCADE
57);
58
59CREATE TABLE actors_series(
60id_actors int not null,
61id_series int not null,
62primary key(id_actors,id_series),
63foreign key(id_actors) REFERENCES actors(id) ON UPDATE CASCADE ON DELETE CASCADE,
64foreign key(id_series) REFERENCES series(id) ON UPDATE CASCADE ON DELETE CASCADE
65);
66
67CREATE TABLE directors_series(
68id_directors int not null,
69id_series int not null,
70primary key(id_directors,id_series),
71foreign key(id_directors) REFERENCES directors(id) ON UPDATE CASCADE ON DELETE CASCADE,
72foreign key(id_series) REFERENCES series(id) ON UPDATE CASCADE ON DELETE CASCADE
73);
74
75CREATE TABLE categories(
76id int AUTO_INCREMENT,
77title varchar(30) not null,
78primary key(id)
79);
80
81CREATE TABLE movies_categories(
82id_movies int not null,
83id_categories int not null,
84primary key(id_movies,id_categories),
85foreign key(id_movies) REFERENCES movies(id) ON UPDATE CASCADE ON DELETE CASCADE,
86foreign key(id_categories) REFERENCES categories(id) ON UPDATE CASCADE ON DELETE CASCADE
87);
88
89CREATE TABLE series_categories(
90id_series int not null,
91id_categories int not null,
92primary key(id_series,id_categories),
93foreign key(id_series) REFERENCES series(id) ON UPDATE CASCADE ON DELETE CASCADE,
94foreign key(id_categories) REFERENCES categories(id) ON UPDATE CASCADE ON DELETE CASCADE
95);
96
97CREATE TABLE slider(
98id int AUTO_INCREMENT,
99id_movies int not null,
100slider_image text not null,
101video_iframe text not null,
102primary key(id),
103foreign key(id_movies) REFERENCES movies(id) ON UPDATE CASCADE ON DELETE CASCADE
104);
105
106CREATE TABLE users(
107id int AUTO_INCREMENT,
108name varchar(40) not null,
109surname varchar(40) not null,
110username varchar(40) not null,
111password varchar(100) not null,
112unique(username),
113primary key(id)
114);
115
116INSERT INTO actors (name,surname,photo_url,bio)
117VALUES
118('Tom','Hanks','https://m.media-amazon.com/images/M/MV5BMTQ2MjMwNDA3Nl5BMl5BanBnXkFtZTcwMTA2NDY3NQ@@._V1_UY209_CR2,0,140,209_AL_.jpg','Thomas Jeffrey Hanks was born in Concord, California, to Janet Marylyn (Frager), a hospital worker, and Amos Mefford Hanks, an itinerant cook. His mothers family, originally surnamed "Fraga", was entirely Portuguese, while his father was of mostly English ancestry.'),
119('Robert','De Niro','https://m.media-amazon.com/images/M/MV5BMjAwNDU3MzcyOV5BMl5BanBnXkFtZTcwMjc0MTIxMw@@._V1_UY317_CR13,0,214,317_AL_.jpg','One of the greatest actors of all time, Robert De Niro was born on August 17, 1943 in Manhattan, New York City, to artists Virginia (Admiral) and Robert De Niro Sr. His paternal grandfather was of Italian descent, and his other ancestry is English, Dutch, German, French and Irish.'),
120('Jack','Nicholson','https://m.media-amazon.com/images/M/MV5BMTQ3OTY0ODk0M15BMl5BanBnXkFtZTYwNzE4Njc4._V1_UY209_CR5,0,140,209_AL_.jpg','Jack Nicholson, an American actor, producer, director and screenwriter, is a three-time Academy Award winner and twelve-time nominee'),
121('Amber','Heard','https://m.media-amazon.com/images/M/MV5BMTQ0MjA1ODU0MV5BMl5BanBnXkFtZTgwNTczNTkwNjE@._V1_UY317_CR10,0,214,317_AL_.jpg','Amber Laura Heard was born in Austin, Texas, to Patricia Paige Heard (nee Parsons), an internet researcher, and David C. Heard (David Clinton Heard), a contractor. She has English, Irish, Scottish, German, and Welsh ancestry. Heard appeared in the Academy Award-nominated film, North Country (2005), in which she played Charlize Theron΄s character in'),
122('Scarlett','Johansson','https://m.media-amazon.com/images/M/MV5BMTM3OTUwMDYwNl5BMl5BanBnXkFtZTcwNTUyNzc3Nw@@._V1_UY317_CR23,0,214,317_AL_.jpg','Scarlett Johansson was born in New York City. Her mother, Melanie Sloan, is from a Jewish family from the Bronx, and her father, Karsten Johansson, is a Danish-born architect, from Copenhagen. She has a sister, Vanessa Johansson, who is also an actress, a brother, Adrian, a twin brother, Hunter Johansson, born three minutes after her'),
123('Norman','Reedus','https://m.media-amazon.com/images/M/MV5BMTQ5ODE4NTgzMl5BMl5BanBnXkFtZTcwODI0MjAwMw@@._V1_UY317_CR5,0,214,317_AL_.jpg','Norman Reedus was born in Hollywood, Florida, to Marianne and Norman Reedus. He is of Italian (from his paternal grandmother), English, Scottish, and Irish descent. Norman΄s first film was in ΄Guillermo Del Toro΄s 1997 horror thriller Mimic (1997), where he played the character Jeremy.'),
124('Andrew','Lincoln','https://m.media-amazon.com/images/M/MV5BMjI2NDYyNjg4NF5BMl5BanBnXkFtZTcwMjI5OTMwNA@@._V1_UY317_CR9,0,214,317_AL_.jpg','Andrew Lincoln is a British actor. Lincoln spent his early childhood in Hull, Yorkshire before his family relocated to Bath, Somerset when he was age 10. He was educated at Beechen Cliff School in Bath, and then the prestigious Royal Academy of Dramatic Art in London. '),
125('Emilia','Clarke','https://m.media-amazon.com/images/M/MV5BNjg3OTg4MDczMl5BMl5BanBnXkFtZTgwODc0NzUwNjE@._V1_UX214_CR0,0,214,317_AL_.jpg','British actress Emilia Clarke was born in London and grew up in Berkshire, England. Her father is a theatre sound engineer and her mother is a businesswoman. Her father was working on a theatre production of "Show Boat" and her mother took her along to the performance. ');
126
127
128INSERT INTO movies(title,photo_url,description,runtime,release_year)
129VALUES
130('Titanic','https://m.media-amazon.com/images/M/MV5BMDdmZGU3NDQtY2E5My00ZTliLWIzOTUtMTY4ZGI1YjdiNjk3XkEyXkFqcGdeQXVyNTA4NzY1MzY@._V1_UX182_CR0,0,182,268_AL_.jpg','A seventeen-year-old aristocrat falls in love with a kind but poor artist aboard the luxurious, ill-fated R.M.S. Titanic.',194,'1997'),
131('Jumanji: Welcome to the Jungle','https://m.media-amazon.com/images/M/MV5BODQ0NDhjYWItYTMxZi00NTk2LWIzNDEtOWZiYWYxZjc2MTgxXkEyXkFqcGdeQXVyMTQxNzMzNDI@._V1_UX182_CR0,0,182,268_AL_.jpg','Four teenagers are sucked into a magical video game, and the only way they can escape is to work together to finish the game. ',119,'2017'),
132('Aquaman','https://m.media-amazon.com/images/M/MV5BOTk5ODg0OTU5M15BMl5BanBnXkFtZTgwMDQ3MDY3NjM@._V1_UX182_CR0,0,182,268_AL_.jpg','Arthur Curry learns that he is the heir to the underwater kingdom of Atlantis, and must step forward to lead his people and be a hero to the world.',143,'2018'),
133('Vicky Cristina Barcelona','https://m.media-amazon.com/images/M/MV5BNjVkZGE1OWItYjMzNC00ZTcwLThiODAtYmYwNzJkMjk5OTVhXkEyXkFqcGdeQXVyMTMxODk2OTU@._V1_UX182_CR0,0,182,268_AL_.jpg','Two girlfriends on a summer holiday in Spain become enamored with the same painter, unaware that his ex-wife, with whom he has a tempestuous relationship, is about to re-enter the picture.',96,'2008');
134
135
136INSERT INTO series(title,photo_url,description,runtime,release_year)
137VALUES
138('The Walking Dead','https://m.media-amazon.com/images/M/MV5BMTcwMDAzMDk3OF5BMl5BanBnXkFtZTgwMjY0MzcyNjM@._V1_UX182_CR0,0,182,268_AL_.jpg','Sheriff Deputy Rick Grimes wakes up from a coma to learn the world is in ruins, and must lead a group of survivors to stay alive.',41,'2010'),
139('Game of Thrones','https://m.media-amazon.com/images/M/MV5BMjE3NTQ1NDg1Ml5BMl5BanBnXkFtZTgwNzY2NDA0MjI@._V1_UX182_CR0,0,182,268_AL_.jpg','Nine noble families fight for control over the mythical lands of Westeros, while an ancient enemy returns after being dormant for thousands of years.',57,'2011');
140
141INSERT INTO actors_movies
142VALUES
143(1,1),
144(2,1),
145(3,2),
146(4,3),
147(5,4);
148
149INSERT INTO actors_series
150VALUES
151(6,1),
152(7,1),
153(8,2);
154
155INSERT INTO categories
156VALUES
157('','ΡΟΜΑÎΤΙΚΗ'),
158('','ΔΡΑΜΑ'),
159('','ΠΕΡΙΠΕΤΕΙΑ'),
160('','ΔΡΑΣΗΣ'),
161('','ΕΠΙΣΤΗΜΟÎΙΚΗΣ ΦΑÎΤΑΣΗΣ'),
162('','ΤΡΟΜΟΥ'),
163('','ΚΩΜΩΔΙΑ'),
164('','ΦΑÎΤΑΣΙΑΣ');
165
166INSERT INTO movies_categories
167VALUES
168(1,1),
169(2,1),
170(3,1),
171(2,3),
172(2,5),
173(2,7),
174(3,4),
175(3,5),
176(4,1),
177(4,2);
178
179INSERT INTO series_categories
180VALUES
181(1,4),
182(1,5),
183(2,4),
184(2,8);
185
186INSERT INTO slider
187VALUES
188('',1,'https://i.pinimg.com/originals/33/8e/c5/338ec5a6964c3cb1778b4ad6dc4da88e.gif','<iframe width="400" height="230" src="https://www.youtube.com/embed/-iRajLSA8TA?start=2" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>'),
189('',2,'https://images.beano.com/store/22f2cf755a2aef5597d4f099fea865196cf9062501e3bf961ddd259faa46?auto=compress&w=960&fit=max','<iframe width="400" height="230" src="https://www.youtube.com/embed/2QKg5SZ_35I?start=2" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>'),
190('',3,'https://data.whicdn.com/images/316420341/original.gif','<iframe width="400" height="230" src="https://www.youtube.com/embed/WDkg3h8PCVU?start=2" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>'),
191('',4,'https://media.giphy.com/media/Gkd4UvZNnn4zu/giphy.gif','<iframe width="400" height="230" src="https://www.youtube.com/embed/B-RdUcXAKiw?start=2" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>');