A project manager is building a budget summary for a kickoff meeting. The project combines a design allocation of $350 and a development allocation of $150.
Write a query to return the combined total in a single column named total_budget.
Output:
- A single row with one column named
total_budget, containing the sum of the two allocations.
Run previews · Check grades
Write a query, then run it to see results here.
Worked solution Try it yourself first
SELECT
350 + 150 AS total_budget The shape
The addition inside the SELECT produces the combined number, and AS total_budget is what makes the column readable as a budget figure on the kickoff slide.
Clause by clause
SELECT 350 + 150evaluates the addition once and returns500. There's noFROMbecause there's no table to read from; the two allocations come straight from the prompt as integer literals. The result is also an integer because both operands are.AS total_budgetis what this node is about. The alias gives the output column the exact header the project manager needs on the slide. Without it, PostgreSQL would label the column?column?— readable to the person running the query, useless to anyone reviewing the budget summary afterwards.
Why this and not skip the alias
The query SELECT 350 + 150 returns the right number, 500, in a column the database calls ?column?. That label is fine while you're checking the math in the editor. The moment the result has to be screenshotted into a deck, exported to a spreadsheet, or read by anyone other than you, the unnamed column reads as a half-finished query. The alias is what turns a one-line calculation into something portable.
You practiced naming a computed column with the AS keyword. Without an alias, PostgreSQL labels arithmetic results with a generated placeholder — AS is the recurring fix any time the output column needs a meaningful name in a report or downstream consumer.