Cheapest and Priciest Side by Side
MediumDescription
For every product show category_id, product_name, and on the same row:
cheapest: the name of the cheapest product in its categorypriciest: the name of the most expensive product in its category
When two products have the same price, the one with the lower product_id counts as cheaper.
End your query with ORDER BY category_id, product_id.
Tables
| products |
|---|
| product_id (PK) |
| product_name |
| category_id (FK) |
| price |