← All Assignments
Movie Database Queries
Problem Statement
Write SQL queries for a movie database schema: movies(id, title, genre, release_year, rating, director_id) directors(id, name, country) actors(id, name, age) movie_actors(movie_id, actor_id, role) Write queries to: 1. List all movies with their director's name and country 2. Find the highest-rated movie in each genre 3. Find actors who have appeared in more than 2 movies
Sample Data
movies: (1,'Inception','Sci-Fi',2010,8.8,1), (2,'The Dark Knight','Action',2008,9.0,1), (3,'Parasite','Drama',2019,8.6,2) directors: (1,'Christopher Nolan','UK'), (2,'Bong Joon-ho','South Korea') actors: (1,'Cillian Murphy',48), (2,'Christian Bale',50), (3,'Song Kang-ho',57) movie_actors: (1,1,'Dom'),(2,2,'Batman'),(1,2,'Eames'),(3,3,'Ki-taek')
Expected Output
Q1: Inception-Nolan-UK, Dark Knight-Nolan-UK, Parasite-Bong-SouthKorea Q2: Sci-Fi=Inception(8.8), Action=DarkKnight(9.0), Drama=Parasite(8.6) Q3: Cillian Murphy (2 movies) — adjust threshold based on data