Wednesday, 4 January 2012

MySql count


MySQL aggregate functions retrieve a single value after performing a calculation on a set of values.
In general, aggregate functions ignore null values.
Often, aggregate functions are accompanied by the GROUP BY clause of the SELECT statement.


MySQL COUNT() function us used to count of number of non-NULL values of a given expression.

This function return 0 when  does not find any matching row from the table.

Syntax

COUNT(expr);
Where expr is an expression.
SELECT COUNT(*)
FROM author;

Explanation

The above MySQL statement will return the number of rows in author table.

Output

mysql aggregate functions and grouping count function

See also : 
 Mysql count() function




No comments:

Post a Comment