GROUP BY in Teradata

Related rows can be grouped together by GROUP BY clause.
This is done by specifying a column in a table as a grouping column.

GROUP BY is associated with aggregate functions.

Syntax:
SELECT column_name
FROM table_name
GROUP BY column_name

With aggregate function
SELECT column_name, AVG(column_name2)
FROM table_name
GROUP BY column_name


Note:
Column name can come along with aggregate function only if it appears in GROUP BY clause.
In the output all the rows with an identical value in the grouping column will be grouped together.

If no GROUP BY clause is specified then the default group will be the entire result set.