To find the highest number of stars received by each movie, we can use the following SQL query:

SELECT Movie.title, MAX(Rating.ratingStars) AS highestStars
FROM Movie
JOIN Rating ON Movie.mID = Rating.mID
GROUP BY Movie.title
ORDER BY Movie.title;

This query joins the 'Movie' and 'Rating' tables using the 'mID' column as the foreign key. Then, it groups the results by movie title and calculates the maximum 'ratingStars' for each movie using the MAX() function. Finally, it orders the results by movie title.

The output of this query will be the movie title and the highest number of stars received by that movie. It will be sorted alphabetically by movie title.

Find the Highest Movie Rating: SQL Query and Explanation

原文地址: https://www.cveoy.top/t/topic/pmQ5 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录