Bird
0
0

Which of the following is true when you use GROUP BY on multiple columns in PostgreSQL?

easy📝 Conceptual Q2 of 15
PostgreSQL - Aggregate Functions and GROUP BY
Which of the following is true when you use GROUP BY on multiple columns in PostgreSQL?
ARows are grouped separately by each column independently
BRows are grouped by the first column only
CRows are grouped by the combination of values in all specified columns
DGrouping is ignored if multiple columns are specified
Step-by-Step Solution
Solution:
  1. Step 1: Understand multi-column grouping

    When GROUP BY uses multiple columns, it groups rows by the unique combination of values across those columns.
  2. Step 2: Clarify incorrect options

    Grouping is not done by only the first column or independently by each column; it is combined. Grouping is never ignored.
  3. Final Answer:

    Rows are grouped by the combination of values in all specified columns -> Option C
  4. Quick Check:

    GROUP BY multiple columns = group by combined values [OK]
Quick Trick: Multiple columns group by combined values [OK]
Common Mistakes:
  • Assuming grouping happens independently per column
  • Ignoring the combination effect
  • Thinking only the first column matters

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes