Bird
0
0

In PostgreSQL, what is the primary function of ARRAY_AGG?

easy📝 Conceptual Q1 of 15
PostgreSQL - Aggregate Functions and GROUP BY
In PostgreSQL, what is the primary function of ARRAY_AGG?
ATo collect multiple row values into a single array
BTo calculate the average of numeric values
CTo concatenate strings from multiple rows into one string
DTo filter rows based on array contents
Step-by-Step Solution
Solution:
  1. Step 1: Understand ARRAY_AGG

    ARRAY_AGG is an aggregate function that collects values from multiple rows into a single array.

  2. Step 2: Differentiate from other functions

    It does not perform calculations like average or string concatenation; those are done by AVG or STRING_AGG respectively.

  3. Final Answer:

    To collect multiple row values into a single array -> Option A
  4. Quick Check:

    ARRAY_AGG aggregates rows into arrays [OK]
Quick Trick: ARRAY_AGG collects rows into arrays, not calculations [OK]
Common Mistakes:
  • Confusing ARRAY_AGG with AVG or STRING_AGG
  • Thinking ARRAY_AGG filters rows

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes