Mysql Null values

Mysql Null Values.
NULL cannot be equal to anything, including itself.

IS NULL operator returns true if column value is NULL.

IS NOT NULL operator returns true if column value is not NULL.

NULL values represent missing unknown data.

NULL values are treated differently from other values

Examples: 
SELECT 1 IS NULL, 1 IS NOT NULL;

Result:

1 IS NULL 1 IS NOT NULL
    0           1

Examples 1:
SELECT * FROM usertable WHERE userid IS NULL

Examples 2:
SELECT IFNULL(USERNAME,'GUEST') FROM USERTABLE WHERE USERID IS NULL

Post a Comment

0 Comments