Decode Analytics

View Original

Group By

The GROUP BY clause groups records into summary row(s). GROUP BY returns one records for each group.

The GROUP BY statement is often used to return a result-set with aggregate functions (COUNT, MAX, MIN, SUM, AVG) for one or more columns.

SQL GROUP BY Syntax:

SELECT Column1, Column2, Column3

FROM Table_Name

GROUP BY  Column1

Example:

Lets use the “Products” table to count the number of products for each supplier.

See this content in the original post

Results:

See this content in the original post

Get a free SQL Code Reference Here

SQL Tutorial

See this content in the original post