Database: SELECT: Summary Functions

Summary functions (also known as aggregate or column functions) produce values from all the cells in a column. SQL1 defines the following:
SUM( {expr | DISTINCT col} ) The sum of the values in the column.
AVG( {expr | DISTINCT col} ) The average value in the column.
MIN(expr) The minimum value in the column.
MAX(expr) The maximum value in the column.
COUNT(DISTINCT col) Counts all non-NULL values in a column.
COUNT(*) Counts number of rows, regardless of NULL values.

Misc Notes

Example - Compute the average GPA for all students

Problem: Compute the average GPA for all students.
This requires only the Students table from the University Database.
/* Compute average GPA for all students */
SELECT 'Average GPA', AVG(stu_gpa)
    FROM Students;