w3resource
SQL exercises

SQL exercises on movie Database: Find the highest-rated movie, and report its title, year, rating, and releasing country

SQL movie Database: Join Exercise-21 with Solution

21. Write a query in SQL to find the highest-rated movie, and report its title, year, rating, and releasing country.

Sample table: movie


Sample table: rating


Sample Solution:

SELECT mov_title, mov_year, rev_stars, mov_rel_country
FROM movie 
NATURAL JOIN rating
WHERE rev_stars = (
SELECT MAX(rev_stars)
FROM rating
);

Sample Output:

                     mov_title                      | mov_year | rev_stars | mov_rel_country
----------------------------------------------------+----------+-----------+-----------------
 The Usual Suspects                                 |     1995 |      8.60 | UK
(1 row)

Practice Online


Movie database model

Query Visualization:

Duration:

Query visualization of Find the highest-rated movie, and report its title, year, rating, and releasing country - Duration

Rows:

Query visualization of Find the highest-rated movie, and report its title, year, rating, and releasing country - Rows

Cost:

Query visualization of Find the highest-rated movie, and report its title, year, rating, and releasing country - Cost

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a query in SQL to find the movie in which the actor appeared whose first and last name are 'Harrison' and 'Ford'.
Next: Write a query in SQL to find the highest-rated Mystery movie, and report the title, year, and rating.

What is the difficulty level of this exercise?



New Content: Composer: Dependency manager for PHP, R Programming