Curriculum
Course: SQL
Login

Curriculum

SQL

SQL References

0/80

MySQL Functions

0/139

SQL Server Functions

0/84

SQL Quick Ref

0/1
Text lesson

COUNT

Example

Provide the count of products in the “Products” table.

SELECT COUNT(ProductID) AS NumberOfProducts FROM Products; 

Definition and Usage

The COUNT() function yields the number of records returned by a select query.

Note: Excluding NULL values from the count.

Syntax

COUNT(expression)

Parameter Values

Parameter

Description

expression

Necessary: A field or a string value is required.

Technical Details

Works in: From MySQL 4.0