Question
Consider the following MovieStars database schema: MovieStar(SNo, sname, gender), Director(DNo, dname, ddob, dcity) Movie(MNo, DNo, title, year, length, STNo, profit) Studio(STNo, sname) StarsIn(SNo, MNo, wage,
Consider the following MovieStars database schema:
MovieStar(SNo, sname, gender),
Director(DNo, dname, ddob, dcity)
Movie(MNo, DNo, title, year, length, STNo, profit)
Studio(STNo, sname)
StarsIn(SNo, MNo, wage, firstrole)
The MovieStar relation stores information about movie stars and SNo is the primary key. The Director relation stores information about directors and the DNo is the primary key. The Movie relation contains a list of movies. For each movie we store a movie number MNo (primary key), director number DNo, title, year of production, length in minutes, the studio number where the movie were filmed and the profit. The Studio relation stores information about studios (STNo is the primary key) and the StarsIn relation stores information about who played in which movie. We store the star number SNo, the movie number MNo, were (SNo, MNo) is the primary key, the wages of the actor/actress for this movie and if he/she had a first role in the movie.
Write the following queries in SQL:
1. List the movie title and year for all the movies directed by Martin Scorsese.
2. List the names of stars who have appeared in at least two movies where the movie length was more than 180 minutes.
3. List the name of star(s) and the the movie title(s) where the movie star was also the director of the movie.
4. For each director, find the average profit of the movies she/he has directed and display the director name and the average profit only if the sum of profits of the movies she/he has directed is more than 2M.
5. Find the names of stars who acted in at least one movie for each studio (have participated in movies for all studios)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started