An e-commerce team might want to render its product catalog with items grouped by category and sorted alphabetically within each category. Using the products table, return category, name, and price ordered by category ascending, then by name ascending within each category.
products
| column | type |
|---|---|
| id | INTEGER |
| name | TEXT |
| category | TEXT |
| price | NUMERIC |
| id | name | category | price |
|---|---|---|---|
| 1 | Zephyr Tent | Camping | 299.99 |
| 2 | Alpine Boots | Footwear | 149.99 |
| 3 | Trail Mix | Snacks | 4.99 |
| 4 | Summit Pack | Camping | 89.99 |
| 5 | Wool Socks | Footwear | 19.99 |
| 6 | Granola Bar | Snacks | 2.49 |
| category | name | price |
|---|---|---|
| Camping | Summit Pack | 89.99 |
| Camping | Zephyr Tent | 299.99 |
| Footwear | Alpine Boots | 149.99 |
| Footwear | Wool Socks | 19.99 |
| Snacks | Granola Bar | 2.49 |
| Snacks | Trail Mix | 4.99 |
Categories are sorted alphabetically: Camping, Footwear, Snacks. Within Camping, "Summit Pack" comes before "Zephyr Tent". Within Footwear, "Alpine Boots" comes before "Wool Socks". The pattern holds for every category.