18.3. Built-in SQL functions and multiple tables

18.3.1. Using aggregate functions

Aggregate functions are functions that work on the data of a column. Sometimes they are referred as group functions in SQL. These functions, in many cases, increase your ability to handle and manipulate information for analysis purposes. Some frequently used aggregate functions are:

COUNT()Returns the number of rows.
SUM()Returns the sum of all values.
AVG()Computes the average of a column.

All these functions can be called while satisfying the condition in the WHERE clause. For example, you can use the following statement to find out how many female employees there are in the people table:

Example. ex18–28.sql – Using Counting Function
 1: SELECT COUNT(*) ...

Get Practical Web Technologies now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.