Professional Documents
Culture Documents
EMP1no int,
ename varchar(50),
job varchar(20),
mgr int,
hiredate date,
sal int,
comm int,
dept int
);
The difference between the two queries is in how they handle NULL values in the
comm column of the emp table.
The first query, SELECT COUNT(comm) FROM emp;, only counts the number of non-NULL
values in the comm column. If there are any NULL values in the comm column, they
will not be counted in the result of this query.
The second query, SELECT COUNT(NVL(comm,0)) FROM emp;, replaces any NULL values in
the comm column with 0 before counting the values. This means that all values in
the comm column, including NULL values, will be counted in the result of this
query.
In summary, the first query will give you the number of employees who earn
commission, while the second query will give you the total number of employees,
including those who do not earn commission.
in pdf
in pdf