MySQL tutorial: COUNT [EN]
top of page
CerebroSQL

MySQL: 

COUNT

Syntax:
COUNT(expr) [over_clause]

Returns a count of the number of non-NULL values of expr in the rows
retrieved by a SELECT statement. The result is a BIGINT value.

If there are no matching rows, COUNT() returns 0.

This function executes as a window function if over_clause is present.
over_clause is as described in
https://dev.mysql.com/doc/refman/8.0/en/window-functions-usage.html.

URL: https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html

Example

mysql> SELECT student.student_name,COUNT(*)
FROM student,course
WHERE student.student_id=course.student_id
GROUP BY student_name;

bottom of page