Skip to Main Content

Breadcrumb

May 4th

Question and Answer

Chris Saxon

Thanks for the question, Seonghyun.

Asked: February 19, 2019 - 1:11 am UTC

Last updated: February 19, 2019 - 11:23 am UTC

Version: 11gR2 Express Edition for Windows x64

Viewed 1000+ times

You Asked

I asked you one last time and I will ask you one more question.

If !=0, we know we should include null, but the result is not null.

If !=0, it is different from zero and null, should not it also contain null if it is not 0?

and Chris said...

If !=0, we know we should include null, but the result is not null.

No!

NULL = ANYTHING => UNKNNOWN

But also:

NULL != ANYTHING => UNKNNOWN

So

NULL != 0

returns

UNKNOWN

Where clauses only return rows where the conditions are TRUE

UNKNOWN <> TRUE

So any row that contains null in comm will NOT return if you search for:

comm != 0

Read up on three-valued logic:

https://en.wikipedia.org/wiki/Three-valued_logic

Is this answer out of date? If it is, please let us know via a Comment

More to Explore

SQL

The Oracle documentation contains a complete SQL reference.