Users Who Have Never Posted
Which registered users have never created a single post?
- Joins
- NULL handling
- Filtering
- Sorting
Challenge brief
Understand the request
Growth Team is running a 'share your first post' campaign and needs users who registered but never published any content.
Find users with zero posts using an anti-join.
Return
- user_id
- username
- country
Constraints
- Return registered users with no posts
- Order by user ID
Data you will use
Review the relevant tables before deciding how to join, filter, or aggregate them.
users
user_idINTEGERusernameVARCHAR(50)emailVARCHAR(100)countryVARCHAR(50)
posts
post_idINTEGERuser_idINTEGER
Hints, when you need them
Open one clue at a time so you still do the reasoning.
Hint 1
You need users with NO matching rows in posts. This is an anti-join: LEFT JOIN users to posts, then keep only rows where the posts side is NULL — meaning no post was found for that user.
Hint 2
LEFT JOIN users to posts on user_id. WHERE p.post_id IS NULL keeps only users with no matching post row.
Hint 3
Start with the tables that establish the result grain for question 18, select the required output aliases, and add the remaining joins, filters, aggregation, and ordering one clause at a time.
Verified SQL answer
Attempt the problem first, then compare structure and reasoning—not just syntax.
Reveal solution and explanation
SELECT u.user_id, u.username, u.email, u.country FROM users u LEFT JOIN posts p ON u.user_id = p.user_id WHERE p.post_id IS NULL ORDER BY u.user_idWhy this works
LEFT JOIN keeps all users even with no posts. Unmatched rows have NULL in all posts columns. WHERE post_id IS NULL isolates zero-post users — the anti-join pattern. alex_brown is the only one.
Success check
1 user — alex_brown (the only user with zero posts)
Expected result
Use this output to verify values, aliases, ordering, and row count.
| user_id | username | country | |
|---|---|---|---|
| 5 | alex_brown | alex@email.com | Australia |
Learn the concepts behind this answer
Strengthen your understanding with these targeted learning topics:
Continue practicing
Explore related company challenges
Google
Independent Google-style search, advertising, user-engagement, and video-product SQL practice.
Netflix
Independent Netflix-style streaming, subscription, catalog, ratings, and engagement SQL practice.
Airbnb
Independent Airbnb-style marketplace, booking, listing, payment, review, and guest analytics SQL practice.
Return to the complete interview preparation experience.