Answer to Question #176179 in Databases | SQL | Oracle | MS Access for ghyuar

Question #176179

Get to top 5 viewed videos which belong to both the genres "Action" (genre_id = 201 ) and "Comedy" (genre_id = 202).

Note:

  • In case, if the no_of_views are same, then sort the output in the ascending order of video_name.

Expected Output Format

video_name no_of_views


1
Expert's answer
2021-04-04T11:15:09-0400
select vc.name,vc.no_of_views
from quiz.video as v,quiz.video_content as vc
where v.genre_id=201 and v.genre_id=202
limit  5;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

Mohan
12.04.21, 07:24

SELECT video.name AS video_name, video.no_of_views AS no_of_views FROM video_genre INNER JOIN video ON video_genre.video_id = video.video_id WHERE video_genre.genre_id IN (201, 202) GROUP BY video.name ORDER BY no_of_views DESC, video_name ASC LIMIT 5;

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS