Skip to content
codeyourself.
← The field guide
A SMALL CHECK. A CLEAR NEXT STEP.

Your SQL runs.
Can you trust the result?

Spot four mistakes that hide behind plausible-looking numbers. Get explanations and a practice starting point, before creating an account.

4 original questionsAbout 5 minutesNo signup or email needed
01 / Output grainA join quietly doubles revenue.

Order A is worth 120 units and has two items. Order B is worth 80 units and has one item. You join orders to items, then SUM(order_total). What happens?

02 / Missing valuesTwo pending rows. One missing amount.

Two rows have status = 'pending'. Their amounts are 25 and NULL. Which expression counts both pending rows?

03 / Safe retriesThe same payment arrives twice.

A source retries payment p-42 after a timeout. The amount and payment ID are unchanged. Your destination should record one payment. What is the strongest approach?

04 / History boundariesA customer changes plan at noon.

Plan X is valid from 09:00 to 12:00. Plan Y is valid from 12:00 to 18:00. A purchase occurs exactly at 12:00. Which rule matches only Plan Y?

Answer all four questions to see your explanations. Answers stay in this page and disappear when you refresh.