The Price List
A buyer at Whetcode Supply is going into a meeting with a supplier and wants the catalogue on one page in front of her. She reads it from the expensive end down, because that is the end the negotiation is about: a percent off the desk is worth more than a percent off everything else combined.
This one is deliberately small. Everything the page needs is already in a single table, and the only decisions are what to show and in what sequence.
products — the catalogue, one row per item on sale. price is what a single unit costs, in dollars.
| id | name | category | price |
|---|---|---|---|
| 1 | Wireless Mouse | electronics | 25.0 |
| 2 | Standing Desk | furniture | 350.0 |
| 3 | Desk Lamp | furniture | 40.0 |
| 4 | Mechanical Keyboard | electronics | 85.0 |
| 5 | Notebook Set | office | 12.0 |
The table already exists in the database — there is nothing to create or load.
Task: Write a query returning two columns, name and price, one row per product in the catalogue, most expensive first. Every product appears, including the cheap ones. No two products share a price, so that single instruction fixes the sequence completely.
Example output — shape only, on an invented catalogue:
| name | price |
|---|---|
| Monitor Riser | 210 |
| Foot Rest | 96 |
| Cable Tidy | 33 |
| Paper Trimmer | 18 |
| Ink Refill | 7 |
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in