0% found this document useful (0 votes)
7 views

SQL Script

Uploaded by

viplaviwade21
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

SQL Script

Uploaded by

viplaviwade21
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

create database MiniNetDB;

use MiniNetDB;

create table actor(


actor_id int primary key,
actor_name varchar(30),
city varchar(30),
dob date
);

create table movie(


movie_id int primary key,
title varchar(30),
genre varchar(30),
release_date date
);

create table subscription(


subscription_id int primary key,
subscription_type varchar(30),
price int,
duration int
);

create table user(


user_id int primary key,
username varchar(30),
email varchar(30),
password varchar(14),
city varchar(30),
country varchar(30),
age int,
subscription_type int,
foreign key (subscription_type) references subscription(subscription_id)
);

create table review(


review_id int primary key,
score int,
review_comment varchar(50),
user_id int,
movie_id int,
foreign key (user_id) references user (user_id),
foreign key (movie_id) references movie (movie_id)
);

create table favouriteMovie(


favourite_id int primary key,
user_id int,
movie_id int,
score int,
foreign key (user_id) references user (user_id),
foreign key (movie_id) references movie (movie_id),
foreign key (score) references review (review_id)
);

create table movieActor(


movie_actor_id int primary key,
movie_actor_role varchar(30),
movie_id int,
actor_id int,
foreign key (movie_id) references movie (movie_id),
foreign key(actor_id) references actor (actor_id)
);

create table watchHistory(


watch_id int primary key,
user_id int,
movie_id int,
watchDate date,
foreign key (user_id) references user (user_id),
foreign key (movie_id) references movie (movie_id)
);

INSERT INTO subscription (subscription_id, subscription_type, price, duration)


VALUES
(1, 'HD', 9.99, 1),
(2, 'UHD', 14.99, 1);

INSERT INTO user (user_id, username, email, password, city, country, age,
subscription_type)
VALUES
(1, 'john_doe', '[email protected]', 'password1', 'New York', 'USA', 28, 1),
(2, 'alice_smith', '[email protected]', 'password2', 'Los Angeles', 'USA', 34, 1),
(3, 'jane_doe', '[email protected]', 'password3', 'Chicago', 'USA', 21, 2),
(4, 'bob_jones', '[email protected]', 'password4', 'Boston', 'USA', 30, 2),
(5, 'emma_johnson', '[email protected]', 'password5', 'San Francisco', 'USA', 25,
1);

INSERT INTO actor (actor_id, actor_name, city, dob) VALUES


(1, 'Millie Bobby Brown', 'Los Angeles', '2004-02-19'),
(2, 'Bryan Cranston', 'Hollywood', '1956-03-07'),
(3, 'Winona Ryder', 'New York', '1971-10-29'),
(4, 'Aaron Paul', 'Boise', '1979-08-27'),
(5, 'David Harbour', 'White Plains', '1975-04-10');

INSERT INTO movie (movie_id, title, genre, release_date) VALUES


(1, 'Stranger Things', 'Sci-Fi', '2016-07-15'),
(2, 'Breaking Bad', 'Drama', '2008-01-20'),
(3, 'The Office', 'Comedy', '2005-03-24'),
(4, 'Parks and Recreation', 'Comedy', '2009-04-09'),
(5, 'The Godfather', 'Crime', '1972-03-24');

INSERT INTO review (review_id, user_id, movie_id, score, review_comment) VALUES


(1, 1, 1, 5, 'Amazing show!'),
(2, 2, 2, 3, 'Good show'),
(3, 3, 3, 4, 'Funny and smart'),
(4, 4, 4, 2, 'Not my taste'),
(5, 5, 5, 5, 'A classic!');

INSERT INTO favouritemovie (favourite_id, score, user_id, movie_id) VALUES


(1, 5, 1, 3),
(2, 4, 1, 4),
(3, 3, 2, 5),
(4, 5, 3, 1),
(5, 4, 4, 2);

You might also like