0 votes
in MariaDB by
What is the use of COUNT() aggregate function?

1 Answer

0 votes
by
MariaDB COUNT() aggregate function is used to return the count of an expression.

The COUNT () Function counts only NOT NULL values.

COUNT (*) counts the total number of rows in a table.

COUNT () would return 0 if there were no matching rows.

Syntax:

SELECT COUNT(aggregate_expression)      

FROM tables      

[WHERE conditions];        

Example

We have a table "Students", having the following data:

MariaDB Count function 1

Count "student_id" from "Students" table:

SELECT COUNT(student_id)    

FROM Students;     

MariaDB Count function 2
...