Mockbit/#41
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
← Back homemockbit.io/q/41
PrivacyTerms© 2026 Mockbit