top of page

SQL Successful Movies

Updated: May 1



SQL Successful Movies

We will determine the results for the SQL successful movies below:



Highest Rated Movies

The numbers in the ravg column are averages over multiple ratings systems. It's a rough measure of how highly critics and audience members rated each movie.

Write a query to select the 5 highest rated movies according to this ravg metric.

 

Answer:

SELECT * FROM movies

ORDER BY ravg DESC LIMIT 5

 

 

Movies that lost money

Write a query to select all movies that lost money.

In other words, the movies WHERE revenue < budget.

 

Answer:

SELECT * FROM movies

WHERE revenue < budget

 

 

Sort by Ratings

Now order the movies that lost money by their ratings average.

Use the DESC flag so the highest rated are first.

 

Answer: 

SELECT * FROM movies

WHERE revenue < budget

ORDER BY ravg DESC


Ready to become a SQL wizard in record time? Dive into the world of databases with our SQL bootcamp!



Whether you're a complete beginner or looking to brush up on your skills, "Mastering SQL" is your ticket to proficiency.



28 views0 comments

Comments


bottom of page