Bird
0
0

Given a table sales with column amount containing values (100, NULL, 200, NULL, 300), what is the result of SELECT SUM(amount) FROM sales;?

medium📝 query result Q4 of 15
SQL - Aggregate Functions
Given a table sales with column amount containing values (100, NULL, 200, NULL, 300), what is the result of SELECT SUM(amount) FROM sales;?
ANULL
B600
C100
D0
Step-by-Step Solution
Solution:
  1. Step 1: Understand SUM behavior with NULLs

    SUM ignores NULL values and sums only non-NULL amounts: 100 + 200 + 300 = 600.
  2. Step 2: Confirm no NULL affects the sum

    NULLs do not add or cause NULL result in SUM.
  3. Final Answer:

    600 -> Option B
  4. Quick Check:

    SUM ignores NULLs and sums non-NULL values = A [OK]
Quick Trick: SUM skips NULLs, sums only actual numbers [OK]
Common Mistakes:
MISTAKES
  • Assuming SUM returns NULL if any NULL exists
  • Counting NULL as zero automatically
  • Confusing SUM with COUNT

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes