SQLeasyJoins~12m
You're analyzing user engagement for a social media platform
Problem
You're analyzing user engagement for a social media platform. Write a query to find all users who have made at least one post, along with their total post count and the date of their most recent post. Include users with NULL usernames, but exclude any posts that were marked as deleted (deleted_at IS NOT NULL). Order results by total post count descending, then by user_id ascending for ties.
Examples
Example 1
Example 2
Constraints
- ›Return columns: user_id, username, post_count, most_recent_post
- ›Only include users who have at least one non-deleted post
- ›Handle NULL usernames by keeping them as NULL
- ›Order by post_count DESC, then user_id ASC
Reference solution
Reference solution available after you attempt the question.
Ready to solve it?
Start a session on Mockbit #41. Write your SQL, run it against real data, and get graded on correctness, efficiency, query structure, and business understanding.
Related SQL questions
- #43A regional bank wants to analyze account activity by branch locationeasy
- #44A medical clinic wants to identify patients who have been prescribed medications...easy
- #45A mobile gaming company wants to identify the top 3 most active players for each...easy
- #42A video streaming platform tracks user viewing sessionshard
- #46A streaming platform wants to identify content that's experiencing 'viewership...medium
← Back homemockbit.io/q/41