Raghu
"Work for a cause and not applause. Live to express and not to impress"
Java Lover<br /> <br />Shankar Reddy <br />SCJP1.4 (88%)
Head First: Calm down and let me get this
straight. You aren�t equal to zero, you aren�t an
empty string variable. And you aren�t even equal to
yourself ? That makes no sense!
NULL: I know it�s confusing. Just think of me
this way: I�m undefined. I�m like the inside of an
unopened box. Anything could be in there, so you
can�t compare one unopened box to another because
you don�t know what�s going to be inside of each
one. I might even be empty. You just don�t know.
To be or not to be. It's a question.
SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Lynn Beighley<br />Author, Head First SQL
Originally posted by Jothi Shankar Kumar Sankararaj:
I really understood the concept of null from the Head First SQL. A database null is like a closed box and you never know what's going to be inside in the future and you cannot compare a closed box with another closed box.
SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Originally posted by Campbell Ritchie:
But nobody has told him what you ought to write.
If I remember correctly, null in Java means something which doesn't exist, and null in SQL means more like the English "don't know." A bit like RM Reddy's birthday. I don't know when it is, so if I were to put RM Reddy into a database with a BIRTHDAY column, I would have to put null in it. Now I would also put null if I entered Shankar Reddy Telukutla's birthday. Remember this is SQL not Java.
Now both values are recorded as null, but if you ask "do these people have the same birthday?" the answer is "don't know" which SQL expresses as null.
I think there is a standard SQL operator something like is-null, but you will have to go through an SQL tutorial like this one (go to Data statements then Where then look for null) and find out what it says there.
BTW: In Java (null == null) returns true.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |