Bird
0
0

What does the SQL clause GROUP BY column1, column2 do?

easy📝 Conceptual Q11 of 15
SQL - GROUP BY and HAVING
What does the SQL clause GROUP BY column1, column2 do?
ASorts the table by column1 and then column2
BGroups rows by unique combinations of values in column1 and column2
CFilters rows where column1 equals column2
DJoins two tables on column1 and column2
Step-by-Step Solution
Solution:
  1. Step 1: Understand GROUP BY purpose

    The GROUP BY clause groups rows that have the same values in specified columns.
  2. Step 2: Apply to multiple columns

    When multiple columns are listed, grouping happens on unique combinations of those columns' values.
  3. Final Answer:

    Groups rows by unique combinations of values in column1 and column2 -> Option B
  4. Quick Check:

    GROUP BY multiple columns = group by combinations [OK]
Quick Trick: GROUP BY multiple columns groups by combined unique values [OK]
Common Mistakes:
MISTAKES
  • Thinking GROUP BY sorts data
  • Confusing GROUP BY with WHERE filtering
  • Assuming GROUP BY joins tables

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes