Users with Support Tickets
Which users have raised at least one support ticket?
- Sorting
- Distinct values
Challenge brief
Understand the request
CRM Team needs a deduplicated list of all users who have ever submitted a support ticket for retargeting in a satisfaction survey.
List distinct user_ids who appear in support_tickets.
Return
- user_id
Constraints
- Return each qualifying user once
- Order by user ID
Data you will use
Review the relevant tables before deciding how to join, filter, or aggregate them.
support_tickets
ticket_idINTEGERuser_idINTEGERproduct_idINTEGERcreated_dateDATEstatusTEXT
Hints, when you need them
Open one clue at a time so you still do the reasoning.
Hint 1
All ticket data is in support_tickets. You need unique user IDs — use SELECT DISTINCT to deduplicate in case a user has multiple tickets.
Hint 2
SELECT DISTINCT user_id FROM support_tickets.
Hint 3
Build question 16 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 DISTINCT user_id FROM support_tickets ORDER BY user_id;Why this works
In this dataset every user has exactly one ticket, so DISTINCT makes no difference. In production with multiple tickets per user, DISTINCT would collapse duplicates. All 12 users appear.
Success check
12 users — all users in the dataset have exactly 1 ticket each
Expected result
Use this output to verify values, aliases, ordering, and row count.
| user_id |
|---|
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |
| 6 |
| 7 |
| 8 |
| 9 |
| 10 |
Previewing 10 of 12 expected rows. Run the query in the editor to inspect the full result.
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.