MariaDB COUNT() Function
In MariaDB database, COUNT function is used to return the count of an expression.
The COUNT () Function counts only NOTNULL values.
We have a table "Students", having the following data:
Count "student_id" from "Students" table:
It shows 8 rows of student_id is available in "Students" table.
Now count "admission_date" from "Students" table:
It shows only 7 rows of "admission_date" column because 1 field is NULL.
COUNT () Function with Single Expression
Count the number of students where "student_name" is "Ajeet" or "Kanchan".
COUNT () Function with Distinct Clause
DISTINCT Clause is used with COUNT () function to prevent duplicate counting. It consists of only original records.
It shows only 2 counts because "student_name" Ajeet has duplicate entries in the table.