Bird
0
0

Why does STRING_AGG ignore NULL values in the aggregated column?

hard📝 Conceptual Q10 of 15
PostgreSQL - Aggregate Functions and GROUP BY
Why does STRING_AGG ignore NULL values in the aggregated column?
ABecause NULLs represent missing data and are skipped in aggregation
BBecause STRING_AGG converts NULLs to empty strings automatically
CBecause NULLs cause syntax errors in STRING_AGG
DBecause STRING_AGG requires all values to be non-NULL
Step-by-Step Solution
Solution:
  1. Step 1: Understand NULL handling in aggregation

    Aggregations typically ignore NULLs as they represent missing or unknown data.
  2. Step 2: Apply to STRING_AGG behavior

    STRING_AGG skips NULL values to avoid including unknown strings in the result.
  3. Final Answer:

    Because NULLs represent missing data and are skipped in aggregation -> Option A
  4. Quick Check:

    NULLs skipped in aggregation functions [OK]
Quick Trick: NULLs are ignored in STRING_AGG aggregation [OK]
Common Mistakes:
  • Thinking NULLs become empty strings
  • Expecting errors when NULLs present

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes