In SQL, i know the use of select * which basically means selecting all rows but what does count(*) do and how does it work?
Asked
Active
Viewed 28 times
-1
-
1https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_count – Andy Refuerzo Oct 09 '22 at 08:39
-
select * which basically means selecting all rows - No it means select all columns the number of rows returned is determined by WHERE conditions and JOIN conditions. – P.Salmon Oct 09 '22 at 09:40
1 Answers
0
This is fairly well documented here https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_count
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. COUNT(NULL) returns 0.

Andy Refuerzo
- 3,312
- 1
- 31
- 38
-
Also very well covered on this site in other reference questions. – Tim Biegeleisen Oct 09 '22 at 08:41