Highly Active Users
Which users have logged more than one product usage session?
- Aggregation
- HAVING
- Sorting
Challenge brief
Understand the request
Customer Success wants to identify highly engaged users who use Microsoft products frequently — more than one session logged.
Find user_ids with more than 1 usage record using HAVING COUNT > 1.
Return
- user_id
Constraints
- Return users with more than one logged usage session
- Order by user ID
Data you will use
Review the relevant tables before deciding how to join, filter, or aggregate them.
usage_logs
log_idINTEGERuser_idINTEGERproduct_idINTEGERusage_dateDATEusage_minutesINTEGER
Hints, when you need them
Open one clue at a time so you still do the reasoning.
Hint 1
Usage sessions are in usage_logs. GROUP BY user_id and count their sessions. HAVING filters after aggregation — use it to keep only users with more than 1 session.
Hint 2
SELECT user_id FROM usage_logs GROUP BY user_id HAVING COUNT(*) > 1.
Hint 3
Build question 14 from the required result grain: choose the driving table, add only the joins and filters needed for that grain, then apply aggregation and deterministic ordering.
Verified SQL answer
Attempt the problem first, then compare structure and reasoning—not just syntax.
Reveal solution and explanation
SELECT user_id FROM usage_logs GROUP BY user_id HAVING COUNT(*) > 1 ORDER BY user_id;Why this works
HAVING COUNT(*) > 1 keeps only users with 2 or more rows. User 1 (2 Office sessions), user 7 (2 Teams sessions), user 8 (2 Azure sessions), user 12 (2 Azure sessions). The other 8 users each have exactly 1 session.
Success check
4 users — user_ids 1, 7, 8, 12 (all have 2 sessions each)
Expected result
Use this output to verify values, aliases, ordering, and row count.
| user_id |
|---|
| 1 |
| 7 |
| 8 |
| 12 |
Learn the concepts behind this answer
Strengthen your understanding with these targeted learning topics:
Continue practicing
Explore related company challenges
Apple
Independent Apple-style product, retail, services, support, workforce, and device-usage SQL practice.
Google
Independent Google-style search, advertising, user-engagement, and video-product SQL practice.
Amazon
Independent Amazon-style e-commerce, warehouse, inventory, and customer analytics SQL practice.
Return to the complete interview preparation experience.