Structured Query Language Made Simple
Fukula Hastings Nyekanyeka Aggregate Functions I will discuss five important aggregate functions: SUM, AVG, MAX, MIN, and COUNT. They are called aggregate functions because they summarize the results of a query, rather than listing all of the rows.
SELECT SUM(LATECHARGE), AVG(LATECHARGE) This query shows the total of all salaries in the table, and the average salary of all of the entries in the table. SELECT MIN(BENEFITS) This query gives the smallest figure of the Benefits column, of the employees who are Managers, which is 12500. SELECT COUNT(*) This query tells you how many employees have Staff status (3). |