We use cookies for site analytics. Accept to help us understand how the site is used. See our Privacy Policy for details.
An easy sql problem, graded against 4 test cases (2 of them hidden).
Query-writing problems - joins, aggregation, window functions, and query tuning.
Reach for it when you see: A schema and a question about the data rather than a function signature.
More SQLproblems →```sql
SELECT DISTINCT c.name
FROM Customers c
INNER JOIN Orders o ON o.customer_id = c.id
ORDER BY c.name;
```
`INNER JOIN` keeps only rows where a match exists in both tables. `DISTINCT` drops duplicates from customers with multiple orders.
Why paper-only: the gitGood sandbox does not run a SQL engine. The simulation produces the same result so you can verify your filter + dedupe + sort logic. In an interview, write the SQL.
Edge cases: customers with no orders are dropped. Orders pointing at missing customer ids contribute nothing. Empty input on either side returns `[]`.
The full reference solution in every supported language stays in the editor above - reveal it there once you have had a real attempt.
Read off this problem's own test suite, so these are the cases a submission actually has to survive.
These apply to the pattern as a whole, not just this problem.