Budget Cheat Sheet
Finance at Kestrel Labs is going into the quarterly planning meeting and wants a one-page cheat sheet on the table in front of everyone: which teams control the money, richest first, so the room spends its attention in proportion to the spend.
This one is deliberately small. Everything the sheet needs is already sitting in a single table; the only decision is what to show and in what sequence.
departments — one row per team. budget is that team's annual budget in dollars.
| id | name | budget |
|---|---|---|
| 1 | Engineering | 900000 |
| 2 | Sales | 400000 |
| 3 | Marketing | 250000 |
| 4 | Data | 500000 |
The table already exists in the database — there is nothing to create or load.
Task: Write a query returning two columns, name and budget, one row per team, largest budget first. Every team appears, including ones whose budget is small. No two budgets are equal, so that single instruction fixes the order completely.
Example output — shape only, on invented teams and budgets:
| name | budget |
|---|---|
| Logistics | 720000 |
| Legal | 310000 |
| Support | 95000 |
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