All problems

Which Department Has the Biggest Budget?

easySQLSorting

Finance at Kestrel Labs is opening next year's planning round, and the first slide of the deck names the team that currently holds the largest budget line.

Four teams is few enough to read off the page, but the deck gets rebuilt every quarter and the figures are revised in between, so Finance wants a query it can re-run rather than a number somebody retyped. The team's name has to come back beside the figure, so that the slide can say which team it is.

departments — one row per team. budget is the annual budget in whole 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 a single row with two columns, name and budget, for the team funded at the highest figure. Exactly one row comes back.

Example output — shape only, on an invented team and figure.

name budget
Research 1250000

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

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…