What is GROUP BY?

Updated May 17, 2026

Short answer

Groups rows for aggregation.

Deep explanation

Used with aggregate functions like SUM and COUNT.

Real-world example

Employee count per department.

Common mistakes

  • Selecting non-aggregated columns.

Follow-up questions

  • GROUP BY vs DISTINCT?
  • Can GROUP BY use expressions?

More T-SQL interview questions

View all →