N001-M3 Tier 1 · Foundations · medium

Return the deal value, the commission rate as a decimal, and the commission amount in dollars in one row

Part of SELECT and Column Expressions in SQL

The problem

Helix Systems' sales manager is generating a commission statement for a recently closed deal. The deal was worth $48,000 and the account manager's commission rate is 7.5%.

Write a query to return the deal value, the commission rate as a decimal, and the commission amount in dollars in one row.

Output:

  • A single row with three columns, in this order: deal_value, commission_rate, and commission_amount.

Run previews · Check grades

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

Worked solution Try it yourself first
Solution query
SELECT
  48000 AS deal_value,
  0.075 AS commission_rate,
  48000 * 0.075 AS commission_amount

The shape

A percentage stored as its decimal form (0.075) and used directly as a multiplier — the row exposes the deal value, the rate, and the resulting commission as three labeled columns.

Clause by clause

  • 48000 AS deal_value is a labeled integer literal. The deal closed at $48,000 in revenue, and the alias names the column so the row reads in commission-statement form, with each number labeled by its role.
  • 0.075 AS commission_rate is the rate expressed as a decimal: 7.5% written as the number SQL can multiply by. SQL only knows the decimal form.
  • 48000 * 0.075 AS commission_amount is the multiplication: an integer times a decimal, producing 3600.000. The trailing zeroes are the scale PostgreSQL chose by combining the input scales — integer = 0 decimal places, 0.075 = 3 decimal places, so the result carries 3. The dollar value is still $3,600; the extra zeroes carry precision through the operation rather than indicating any rounding.

Why decimal form and not the percentage notation

SQL has no % operator. A rate written as 7.5% is not something the engine can multiply by — there's no syntax for it. So percentages live in queries as their decimal form: 7.5% becomes 0.075, 25% becomes 0.25, and so on. The conversion is just "drop two decimal places."

The same form works in either direction. If a question gives you a decimal rate and asks for the percentage, you multiply by 100. If it gives you a percentage and asks for the resulting amount, you divide the percentage by 100 to get the decimal, then multiply. The decimal is the form SQL works in.

You practiced expressing a percentage as its decimal form (0.075) and using it to scale another value. Decimal-rate-times-quantity is the recurring shape for every percentage calculation in SQL.

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.