Monday, October 5, 2009
Difference Between Count(*) and Count(1) in SQL
Both will be same in terms of performance, as the execution is to retrieve information from the table. You are free to use any constant expression instead of * - you can use COUNT(0), COUNT('a') and even COUNT(NULL) - each with the same results. You can also use a column name as the parameter, but this means that rows with a NULL on that column will not be counted The 'normal' parameter for COUNT is * - in most cases there is no reason to use anything else
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment