programming-examples/sql/SQLMovieDatabase/31. Write a query in SQL to find the reviewer's name and the title of the movie for those reviewers who rated more than one movies.sql

8 lines
378 B
MySQL
Raw Normal View History

2019-11-18 14:05:53 +01:00
/*31. Write a query in SQL to find the reviewer's name and the title of the movie for those reviewers who rated more than
one movies. */
SELECT rev_name, mov_title
FROM reviewer, movie, rating, rating r2
WHERE rating.mov_id=movie.mov_id
AND reviewer.rev_id=rating.rev_ID
AND rating.rev_id = r2.rev_id
GROUP BY rev_name, mov_title HAVING count(*) > 1;