N001-E2 Tier 1 · Foundations · easy

Return the total cost for a 12-month subscription

Part of SELECT and Column Expressions in SQL

The problem

Streamhub is tracking software vendor spend ahead of next quarter's budget review. A procurement analyst is documenting the cost of one analytics tool that is billed at $29.99 per month on a monthly cycle.

Write a query to return the total cost for a 12-month subscription.

Output:

  • A single row with one column, annual_cost.

Run previews · Check grades

Write a query, then run it to see results here.

Worked solution Try it yourself first
Solution query
SELECT
  29.99 * 12 AS annual_cost

The shape

The multiplication inside the SELECT rolls a monthly cost into an annual one, and AS annual_cost makes the result readable in the business unit the procurement analyst is working in.

Clause by clause

  • SELECT 29.99 * 12 evaluates the multiplication once and returns 359.88. There's no FROM because there's no table to read from; the rate and the cycle length come straight from the prompt as literals. The result carries two decimal places because 29.99 does — when PostgreSQL multiplies a numeric by an integer, it keeps the scale of the more precise operand. So the dollars-and-cents precision survives the calculation intact.
  • AS annual_cost labels the output column so the result reads as a domain quantity. Without it, the column would land as ?column? in the budget review — readable to the analyst running the query, useless to anyone else looking at the screenshot later. Labelling at the source is what makes a one-off calculation portable into a report or a spreadsheet without renaming it after the fact.

You practiced multiplying inside a SELECT and labeling the result with AS. The same shape recurs anytime a computed value needs a clear name in the result.

How you actually get good at SQL

Reading explains SQL. Writing it, over and over with instant feedback, is what makes you fluent.

That's the whole SQLMaxx loop: 600+ real problems, instant AI feedback, mastery you can actually see, and spaced review that won't let you forget.

A stack of SQL practice problem cards, the top card showing an employees table.
615 problems · 66 concepts

Real problems. Not toy examples.

615 hand-built problems spanning all 66 concepts, from basic SELECTs to window functions, built on real schemas and real business questions, the kind you'll actually get asked on the job. Enough reps to make SQL automatic.

A retro computer showing a SQL query marked correct with a green checkmark.
Instant AI feedback

Write a query. Know if it's right in one second.

No copying an answer and hoping it clicked. The AI grader checks your real query against real data, catches exactly what's wrong, and explains the fix in plain English, like a senior analyst reading over your shoulder on every problem.

A circular mastery progress dial filling from blue to green, the SQLMaxx diamond at its center.
Mastery tracking

Stop guessing whether you actually know it.

SQLMaxx tracks every concept and shows you what you've mastered and what's still shaky. Your skills fill in one concept at a time, so 'I think I get joins' becomes something you can prove.

A SQL query editor circled by a blue return arrow with a clock, scheduled to come back for review.
Spaced review

Learn it once. Keep it for good.

Most of what you learn this week fades by next week. So when a concept comes due for review, SQLMaxx hands you a fresh problem to solve from a blank editor, not a flashcard to re-read. A research-backed spaced-repetition algorithm (FSRS) times each return for right before you'd forget, so your SQL is still there months later, when the interview or the job actually needs it.

Practice, feedback, mastery, review. That's the loop that turns reading into real skill.

Start free

No account, no credit card. Start solving in under a minute.