Loading...
Top Content by Views
A medium SQL interview practice problem on DataDriven. Write and execute real sql code with instant grading.
- Domain
- SQL
- Difficulty
- medium
Problem
Inner-join content_items to page_views on creator_id = user_id (treating each page_view by a user as a view of any content authored by that user). Per content_id, count view rows. Rank content items by that count descending with standard RANK (ties skip). Return title and view_count for items at rank 5 or less. Sort by view_count descending, tie-break alphabetically by title.
Practice This Problem
Solve this SQL problem with real code execution. DataDriven runs your SQL queries against a real database and grades it automatically.