Users with Multiple Searches
Which users have submitted more than 10 search queries in total?
- Aggregation
- HAVING
- Sorting
Challenge brief
Understand the request
Search Quality is identifying power users who generate disproportionate search volume to study their behaviour patterns.
Return user_id in the declared deterministic order.
Return
- user_id
Constraints
- Return users with more than ten search records
- Order by user ID
Data you will use
Review the relevant tables before deciding how to join, filter, or aggregate them.
search_queries
query_idINTEGERuser_idINTEGERquery_textVARCHAR(200)search_dateDATE
Hints, when you need them
Open one clue at a time so you still do the reasoning.
Hint 1
Search volume must be evaluated after grouping by user.
Hint 2
Apply the threshold to the grouped count.
Hint 3
Return qualifying user keys in stable order.
Verified SQL answer
Attempt the problem first, then compare structure and reasoning—not just syntax.
Reveal solution and explanation
SELECT user_id FROM search_queries GROUP BY user_id HAVING COUNT(*) > 10 ORDER BY user_idWhy this works
HAVING filters AFTER aggregation. WHERE runs before grouping so it cannot reference COUNT(*). Only user 1 has more than 10 searches (they have 14). The next highest is 3 searches.
Success check
Returns the complete deterministic result for users with multiple searches
Expected result
Use this output to verify values, aliases, ordering, and row count.
| user_id |
|---|
| 1 |
Learn the concepts behind this answer
Strengthen your understanding with these targeted learning topics:
Continue practicing
Explore related company challenges
Meta
Independent Meta-style social-product, engagement, content, community, messaging, and advertising SQL practice.
Microsoft
Independent Microsoft-style cloud, productivity, subscription, usage, support, and customer analytics SQL practice.
Netflix
Independent Netflix-style streaming, subscription, catalog, ratings, and engagement SQL practice.
Return to the complete interview preparation experience.