Home >> SQL >> Group By in SQL

Group By in SQL

The GROUP BY used to group the related rows together based on the column value(column on which group by is applied).

After GROUP BY, WHERE command is not used to put restriction for doing this HAVING clause is used.

It is used with aggregate functions (COUNT, MAX, MIN, SUM, AVG) to group the result set by one or more columns.

Syntax

SELECT column1,column2 FROM tablename WHERE condition GROUP BY column1

Post Your Comment

Next Questions
Distinct keyword
Sorting
Between
Having
Union
Union all
Exits
Not Exits
Any
All
Max
Min
Avg
Count
Sum

Copyright ©2022 coderraj.com. All Rights Reserved.