Difference between NOT and NOT IN

UDA
Enthusiast

Difference between NOT and NOT IN

Can you please help me with the difference between below queries.

Sel * from TABLE
where NOT (NAME= 'L'
AND ID= '123')

Sel * from TABLE
where (NAME<> 'L'
AND ID<> '123')

I assumed that both should work in the same way.. But I observe that they dnt give me the same output. I am not sure how this works.

Thanks!

Prajith
2 REPLIES
Enthusiast

Re: Difference between NOT and NOT IN

This is incorrect according to Boolean Theory, both or not equivalent logically. The correct equivalent of original stmt would be

Sel * from TABLE
where (NAME <> 'L' OR ID <> '123')

Please refer any basic computer science book to refresh your memory :)
Enthusiast

Re: Difference between NOT and NOT IN

how can you expect the same output you have used '=' operator and in the other query '<>'
Funny!!!!!!!!!!!!!Guru is correct