Introduction to SQLite GROUP BY
clause
The GROUP BY
clause is an optional clause of the SELECT
statement. The GROUP BY
clause a selected group of rows into summary rows by values of one or more columns.
The GROUP BY
clause returns one row for each group. For each group, you can apply an aggregate function such as MIN
, MAX
, SUM
, COUNT
, or AVG
to provide more information about each group.
The following statement illustrates the syntax of the SQLite GROUP BY
clause.
SELECT
column_1,
aggregate_function(column_2)
FROM
table
GROUP BY
column_1,
column_2;