Products Under $50
Whetcode Supply sells desk gear online. Marketing is building a "Small stuff, small prices" strip for the homepage: everything the shop sells for less than $50, with the cheapest item at the top so the strip opens on the friendliest number. The price has to appear next to each name, because the whole point of the strip is the price.
Two things are being asked for at once here, and they are independent of each other: which products belong on the strip, and the sequence they appear in. Also note the copy says under $50, and legal reads the copy — an item at exactly $50 does not belong.
products — one row per item in the catalogue. price is the cost of a single unit, 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, for every product costing less than $50, cheapest first.
Example output — shape only, on an invented catalogue. Prices come back as plain numbers, so a price of eight dollars prints as 8.
| name | price |
|---|---|
| Paper Tray | 8 |
| Cable Clip | 19 |
| Monitor Riser | 33 |
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