Count(*) vs Count(column_name)
We use count(*) to get the total number of records.SQL>select count(*) from emp2;
Note:-There is no difference between count(*) and count(1) .
SQL>select count(1) from emp2;
But there is a difference between count(*) and count(column_name) .Count(*) return the total number of records of table and count(column_name) return the count of records that have not null value in that column.
SQL>select count(empno) from emp2;
See the reference screen
0 comments:
Post a Comment
Note: only a member of this blog may post a comment.