Question: You will need to write SQL queries over the IMDB database schema: actor (id, fname, lname, gender) movie (id, name, year) directors (id, fname, lname)


You will need to write SQL queries over the IMDB database schema: actor (id, fname, lname, gender) movie (id, name, year) directors (id, fname, lname) casts (pid, mid, role) movie_directors (did, mid) genre (mid, genre) The above schema has the following constraints: - actor.id, movie.id, and director.id are primary keys for the corresponding tables - casts.pid is a foreign key to actor.id - casts.mid is a foreign key to movie.id - movie_directors.did is a foreign key to directors.id - movie_directors.mid is a foreign key to movie.id - genre.mid is a foreign key to movie.id Write the following SQL queries. 1. Q1: Return the names of movies directed by Frank Darabont. Eliminate any duplicates in the result. Submit the query in file Q1.sq1. 2. Q2: Compute the number of roles that were cast in 'The Shawshank Redemption'. Do not eliminate duplicates in case of multiple roles with the same name, or multiple movies with the same title. Submit the query in file Q2.sq1. 3. Q3: Compute how many actors appeared in a movie released in 1995. Submit the query in file Q3.sq1. 4. Q4: Compute how many actors appeared in a movie released in 1995 and also in a movie released in 2010. Submit the query in file Q4.sq1. 5. Q5: Return the number of actors who have played two (or more) roles in the same movie. (If an actor has played multiple roles in several movies, they should be counted only once.) Submit the query in file Q5.sql
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
