Bird
0
0

Given the table Payments with values:

medium📝 query result Q4 of 15
SQL - Aggregate Functions
Given the table Payments with values:
Amount
150
250
NULL
350
What will the query SELECT AVG(Amount) FROM Payments; return?
A200
B250
CNULL
D300
Step-by-Step Solution
Solution:
  1. Step 1: Identify non-NULL values

    Values are 150, 250, 350 (NULL ignored).
  2. Step 2: Calculate average

    (150 + 250 + 350) / 3 = 750 / 3 = 250.
  3. Final Answer:

    250 -> Option B
  4. Quick Check:

    AVG ignores NULLs and averages non-NULL values [OK]
Quick Trick: AVG ignores NULLs when calculating average [OK]
Common Mistakes:
MISTAKES
  • Including NULL in average calculation
  • Expecting NULL as result due to NULL presence
  • Miscomputing sum or count

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes