2017  Kodetalk | Feedback | Privacy Policy | Terms | About
userimage

what's the difference between count(column) and count(*)?

what is the difference between count(*),count(column name) in oracle.
userimage

Count(*) will gives the number of records from the total table.

Count(columnname) will work on particular column . So if that column is having null then count will be reduced.

select count(empno),count(*),count(deptno),count(comm) from emp;

O/p:

COUNT(EMPNO)    COUNT(*)      COUNT(DEPTNO)     COUNT(COMM)

------------                     ----------                -------------               -----------

          14                                  14                          14                       4

Here comm  column is having nulls. 

Answer is