Today, we will learn commonly used aggregate functions which are very handy for aggregation and statistical analysis.
The function returns the number of rows that matches a specific condition of a query.
There are different ways to use the function.
function returns the number of rows in the table, including NULL and duplicate rows.
Bear in mind that using the function on a large data set slows down the query because SQL must scan all the rows for all columns.
Example
The function returns the number of rows in the specific column. However, it does not consider NULL values in the column.
Example
The function returns the number of unique non-null values in the column.
Example
Example
Example
returns the sum of values or distinct values. However, It ignores NULL values.
Example
function calculate the average value of a column.
Example
The function returns the minimum value of a column and the function returns the maximum value of a column.
Example
Next Lesson
Filtering with LIKE and Pattern Matching