MySQL Tutorial

A database system used with PHP.

MySQL COUNT(), AVG(), SUM()

MySQL Aggregate Functions

  • COUNT(): returns the number of rows that matches a specified criterion.
  • AVG(): returns the average value of a numeric column.
  • SUM(): returns the total sum of a numeric column.

COUNT() Syntax:

SELECT COUNT(column_name) FROM table_name WHERE condition;

Try It Yourself

Edit the code below and click Run to see the result live.

Source Code
Result
Topics