N011-M4 Tier 1 · Foundations · medium

Return what the calculation `base * multiplier` produces in its current state, in a single column named `payout`

Part of Arithmetic and Comparison Expressions in SQL

The problem

A claims adjuster is preparing the payout calculation for a property insurance claim. The base value is confirmed at $5,000, but the adjustment multiplier has not yet been entered — it currently sits at NULL in the system.

Write a query to return what the calculation base * multiplier produces in its current state, in a single column named payout.

Output:

  • A single row with one column, payout. The single value in this row should reflect the result of multiplying 5000 by NULL.

Run previews · Check grades

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

Worked solution Try it yourself first
Solution query
SELECT
  5000 * NULL AS payout

The shape

Any arithmetic involving NULL produces NULL. The missing multiplier propagates through the operator, and the calculation yields NULL rather than 0 or the base value alone.

Clause by clause

  • SELECT 5000 * NULL evaluates the multiplication, but with one operand missing the result is also missing. PostgreSQL has no rule that defaults NULL to zero, no rule that treats it as the identity for multiplication, no rule that falls back to the other operand. NULL means "unknown," and any operation on an unknown value is itself unknown. The single value that comes back is NULL.
  • AS payout labels the column as the calculation's output. The column appears in the result set with a single row whose value is NULL, which is the honest answer to the claim adjuster's question: the payout cannot be determined until the multiplier is entered.

Why this and not a fallback like zero

A reader coming from spreadsheet logic might expect 5000 * NULL to return 5000 or 0. SQL does neither. The propagation rule is consistent across every arithmetic operator: addition, subtraction, multiplication, and division with NULL all return NULL. Treating the missing multiplier as 1 or 0 would be a guess, and SQL does not guess. The claim system is showing the honest answer: the calculation is not ready because the multiplier has not been entered yet.

The trap

A NULL in one operand silently nullifies the entire result. There's no error, no warning, no row dropped from the output — just a single cell that comes back blank where a number was expected. The audit trail looks like "the calculation produced nothing," not "one input is missing." Any time an arithmetic expression sources from a nullable column, missing inputs have to be handled explicitly or the result will go quiet on the rows that need it most.

You practiced multiplying by NULL and watching the result propagate. The recurring rule: any arithmetic operation on a NULL operand returns NULL — a single missing input silently nullifies the entire calculated column, which is why production calculations almost always wrap nullable inputs in COALESCE.

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.