What does GROUP BY do?

SQL aggregates and GROUP BY · Freshers

Model answer

It groups rows that have the same values in the given columns so you can aggregate each group: SELECT city, COUNT(*) FROM customers GROUP BY city. Every selected column must either be in GROUP BY or inside an aggregate function.

Learn this topic

GROUP BY and HAVING: Summaries for Each Group in the course SQL for Beginners: Learn Databases Step by Step.

Sign in to add your own answer.

More questions