-
Notifications
You must be signed in to change notification settings - Fork 0
7. null in sql
thuantt0101 edited this page Nov 30, 2019
·
1 revision
-
In a Boolean expression the “=” sign is used to check for equality of 2 values. So, Mathematically the Boolean expression X = Y will check whether the value of X is EQUAL to the value of Y or not.
-
Hence, the Boolean expression “A = NULL” (where A is some attribute) will check whether the value of A is EQUAL to NULL or not. But NULL actually means NO VALUE. And we can not compare some value with NO VALUE. Hence, the Boolean expression “A = NULL” will always result into NULL (whether A is NULL or not).
-
Hence, to check if the attribute A is having some value or not, the appropriate Boolean expression will be “A IS NULL”, to check if A doesn’t have any value, OR “A IS NOT NULL”, to check if A has some value.
-
Hope this answers your question.