Grouping


The theory of grouping query results is similar to ordering and limiting query results concepts in that it uses a GROUP BY clause.  See sample format below;


ex.: 

    SELECT column(s)

    from table 

    Where clause 

    Group by column 

    Order by column LIMIT x


The grouping, aka or aggregate, functions are normally used with the Group By clause in a SQL query and below are the supported functions and as follows;


Function

Usage

Purpose

MIN()

Min(column)

returns the smallest value from the said column name

MAX()

Max(column)

returns the largest value from the said column name

SUM()

SUM(column)

returns the SUM of all values in the column

COUNT()

Count(column)

counts the number of rows in the table