Count() Function with Different Parameters
The COUNT() function returns the number of rows that matches specified criteria.It is an aggregate function that counts the number of rows accessed in an expression
- SELECT COUNT(*) FROM Table_Name;
- Returns total number of rows in a table regardless of NULL values and duplicates.
- Asterisx is a typical sign of a meaning “Everything” so this function counts ALL the rows. if you want to count all the rows in a table you should use COUNT(*).
- SELECT COUNT(Col) FROM Table_Name;
Return count of non-null values in column Col.
Returns not null occurrences. Number of records in the table regardless of NULL values and
duplicates.
If you want to count not null occurrences in a table – the best solution is
COUNT (<expression>) COUNT(1) is nothing other than COUNT(<expression>).
0 Comments