Sites per Region
Problem
A logistics company stores its facilities in warehouses(region, site). For each region, combine all of its sites into a single comma-and-space separated string (', '), with the site names listed in alphabetical order. Return region and the combined string aliased as sites, ordered by region.
Tables
Example rows — the live problem includes the full dataset.
warehouses
| region | site |
|---|---|
| North | Aberdeen |
| North | Carlisle |
| North | Bradford |
Expected output
Your answer should return 3 rows with the columns region, sites.
Starter code (SQL)
SELECT *
FROM warehouses;Solve this SQL question free
Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.
Solution & explanation
Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.
Sign up free to unlock