GROUP BY

SQL GROUP BY Keyword

The GROUP BY keyword is used to group rows that share the same value in specified columns. It’s commonly paired with aggregate functions like COUNT(), SUM(), AVG(), MIN(), and MAX() to summarize data.

Tutorials dojo strip

SQL GROUP BY Syntax

SQL

SQL GROUP BY Patients Gender Example

This query lists how many patients are grouped by gender:

SQL

SQL GROUP BY Doctors Specialty Example

This query counts how many doctors belong to each specialty in the Doctors table and lists them from highest to lowest count:

SQL

SQL GROUP BY Labs

Tutorials dojo strip