This lab covers SQL built-in aggregate functions, data grouping, and grouping with ROLLUP.

Aggregation Functions

1) Basics

SQL provides some built-in functions for performing data aggregation and grouping. The main ones are:

Aggregate functions can be used as expressions only in the following:

Basic syntax:

SELECT *aggregate_function*([DISTINCT] *expression*), ... FROM *tbl_name,...* [WHERE *where_condition*];

where expression is a column or an expression involving columns (like an arithmetic expression). expression cannot be however an aggregate function.

SELECT MIN(price) AS "Lowest price"  FROM Product;