The COUNT function
The COUNT()
function returns the number of rows that matches a specified criterion.
The syntax for the count function in [[The SELECT statement]] is:
SELECT COUNT(column_name)
FROM table_name
WHERE condition;
There is also the COUNT(DISTINCT)
function that helps you find the number of times unique values are encountered in a given column
The syntax for the `COUNT(DISTINCT)` function in [[The SELECT statement]] is:
SELECT COUNT(DISTINCT column_name)
FROM table_name
WHERE condition;
The COUNT(*)
function returns all the rows in a table including null values. In the other examples, null values are excluded.