Which is More Correct: COUNT(*) vs. COUNT(column-name)?
The SQL aggregate function COUNT can be used in two ways: COUNT(*) and COUNT(column-name). While both methods aim to tally the number of rows, there are subtle differences to consider.
COUNT(*)
COUNT(column-name)
In your example code:
Choosing between COUNT(*) and COUNT(column-name) depends on the desired output:
The above is the detailed content of COUNT(*) vs. COUNT(column-name): Which SQL Aggregate Function Should I Use?. For more information, please follow other related articles on the PHP Chinese website!