w3resource
SQL Exercises

SQL Exercises, Practice, Solution - BASIC exercises on movie Database

SQL [10 exercises with solution]

[An editor is available at the bottom of the page to write and execute the scripts.]

Sample Database:

Movie database model

1. Write a query in SQL to find the name and year of the movies. Go to the editor

Sample table: movie


Click me to see the solution

2. Write a query in SQL to find the year when the movie American Beauty released.  Go to the editor

Sample table: movie


Click me to see the solution

3. Write a query in SQL to find the movie which was released in the year 1999.  Go to the editor

Sample table: movie


Click me to see the solution

4. Write a query in SQL to find the movies which was released before 1998.  Go to the editor

Sample table: movie


Click me to see the solution

5. Write a query in SQL to return the name of all reviewers and name of movies together in a single list.  Go to the editor

Sample table: movie


Sample table: reviewer


Click me to see the solution

6. Write a query in SQL to find the name of all reviewers who have rated 7 or more stars to their rating.  Go to the editor

Sample table: reviewer


Sample table: rating


Click me to see the solution

7. Write a query in SQL to find the titles of all movies that have no ratings.  Go to the editor

Sample table: movie


Sample table: rating


Click me to see the solution

8. Write a query in SQL to find the titles of the movies with ID 905, 907, 917.  Go to the editor

Sample table: movie


Click me to see the solution

9. Write a query in SQL to find the list of all those movies with year which include the words Boogie Nights.  Go to the editor

Sample table: movie


Click me to see the solution

10. Write a query in SQL to find the ID number for the actor whose first name is 'Woody' and the last name is 'Allen'.  Go to the editor

Sample table: actor


Click me to see the solution

Practice Online


More to Come !

Query visualizations are generated using Postgres Explain Visualizer (pev)

Do not submit any solution of the above exercises at here, if you want to contribute go to the appropriate exercise page.


ankara escort
kızılay escort