SQL: COUNT() Aggregate Function
The COUNT() function returns the number of rows in the specified table. There are two ways you can use COUNT(), which are the following:
The query above returns the number of rows in the Customers table
The query above counts the number of rows for the column "Region" that are not NULL
- COUNT(*) count all the rows in the table including
- COUNT(column) return all the rows that contains value for the column, excluding the columns with null value
SELECT COUNT(*) AS NumberOfRows
FROM Customers
The query above returns the number of rows in the Customers table
SELECT COUNT(Region) AS NumberOfRows
FROM Customers
The query above counts the number of rows for the column "Region" that are not NULL
Comments
Post a Comment