What does GROUP BY mean?

In databases & SQL, GROUP BY means the SQL clause that puts rows with the same values into groups so that a total, count or average can be calculated for each group.

phraseCore term

Databases & SQL vocabulary · SQL Statements and Queries

In Turkish: gruplama, GROUP BY ifadesi

Also used in: Software Engineering

How it is used

Used with aggregate functions: SELECT city, COUNT(*) FROM customers GROUP BY city. In standard SQL every selected column that is not inside an aggregate function must appear in GROUP BY; breaking this rule is one of the most common SQL errors.

Example sentences

  1. Group by month to see how revenue changed over the year.

  2. The query fails because product_name is in the SELECT list but not in the GROUP BY.

Common collocations

  • GROUP BY a column
  • group by date
  • GROUP BY with HAVING
  • grouped results

More terms: SQL Statements and Queries

Practise with graded reading

Reading at the right level is the fastest way to make new words stick. Pick free English books by level: