All problems

Departments With Above-Average Budget

mediumSQLSubqueries

Finance at Kestrel Labs is running a "who is expensive?" review. The bar is not a fixed figure — it moves with the company. A team makes the list if it is funded above what a typical team gets, and "typical" is defined here as the mean budget across all four teams.

That is the difficulty in one sentence: the threshold you are testing rows against is itself derived from the very rows you are testing, including the row under test. It does not exist in the table, and it cannot be worked out one row at a time.

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 column, name, listing every team funded above the mean budget across all teams. Row sequence does not matter.

Example output — shape only, on invented teams.

name
Facilities
Research

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…