Bird
0
0

Why does the SQL AVG() function ignore NULL values when calculating the average?

hard📝 Conceptual Q10 of 15
SQL - Aggregate Functions
Why does the SQL AVG() function ignore NULL values when calculating the average?
ABecause NULL values cause AVG() to return NULL always
BBecause NULL is treated as zero in AVG()
CBecause AVG() only works on non-nullable columns
DBecause NULL means unknown, so it is excluded from calculations
Step-by-Step Solution
Solution:
  1. Step 1: Understand NULL meaning in SQL

    NULL represents unknown or missing data, not zero or any number.
  2. Step 2: AVG() ignores NULL to avoid skewing results

    Including NULL as zero would lower average incorrectly, so NULLs are excluded.
  3. Final Answer:

    Because NULL means unknown, so it is excluded from calculations -> Option D
  4. Quick Check:

    NULL excluded in AVG() because it's unknown [OK]
Quick Trick: NULL means unknown, so AVG() skips it [OK]
Common Mistakes:
MISTAKES
  • Treating NULL as zero
  • Expecting AVG() to return NULL if any NULL present

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes