Pages

Showing posts with label Count(columnName). Show all posts
Showing posts with label Count(columnName). Show all posts

3 August 2013

SQL- COUNT(ColumnName) and COUNT(*)

Q.What is the difference between count(Column Name) and count(*)?

         Count(Column Name)- It returns the total number of rows in a table                                                    excluding NULL.

         Count(*)- It returns the total number of rows in a table  including NULL.
         
     Let us consider a below 'Customer' table. Column 'ProductId' of this table has two NULL values.


Customer Table