SQL Group By Clause

SQL Group By Clause

In this article You will learn, group by clause is used to group the results of a SELECT query based on one or more columns. It is also used with SQL functions to group the result from one or more tables.




SELECT column_name, function(column_name)
FROM table_name 
WHERE condition 
GROUP BY column_name



SELECT name, age 
FROM Employee GROUP BY salary

Example of Group by in a Statement with WHERE clause

SELECT name, salary 
FROM Employee 
WHERE age > 29
GROUP BY salary