2017  Kodetalk | Feedback | Privacy Policy | Terms | About

comm!=300 in emp not working

When i tried 

select * from emp where comm=300;

giving 1 record.

In total emp table contains 14 records.

When i try 

select * from EMP where COMM !=300;

Getting only three records. Why i am not getting remaining records.

Please help anyone


In emp table comm column we will have nulls. most of the functions (except nvl function) will not handle with null values.

So you must try below

select * from EMP where COMM!=300 or COMM is null;


select * from EMP where nvl(COMM,0)!=300 ;

You will get 13 records.
Answer is