SQL interview question: List Unique Values per Category
List Unique Product Categories
The catalog team needs a clean list of all product categories without duplicates.
Return unique categories and the price range (min and max price) for each.
Return category, min_price, and max_price. Order by category.
Skills: DISTINCT with GROUP BY and aggregate functions
Tables
products 20 rows
- product_id integer PK
- product_name text
- category text
- price real
- rating real
| product_id | product_name | category | price | rating |
|---|---|---|---|---|
| 1 | MacBook Pro | Electronics | 1999.99 | 4.8 |
| 2 | iPad Air | Electronics | 599.99 | 4.8 |
| 3 | AirPods Pro | Electronics | 249.99 | 4.7 |