programming-examples/sql/SQLMovieDatabase/38. Write a query in SQL to return the reviewer name, movie title, and stars in an order that reviewer name will come first, then by movie title, and lastly by number of stars.sql

8 lines
421 B
MySQL
Raw Normal View History

2019-11-18 14:05:53 +01:00
/*38. Write a query in SQL to return the reviewer name, movie title, and stars in an order that reviewer name will come
first, then by movie title, and lastly by number of stars. */
SELECT rev_name, mov_title, rev_stars
FROM movie
INNER JOIN rating ON movie.mov_id = rating.mov_id
INNER JOIN reviewer ON reviewer.rev_id = rating.rev_id
WHERE rev_name IS NOT NULL
ORDER BY rev_name, mov_title, rev_stars;