Knowledge Walls
John Peter
Pune, Maharashtra, India
NULL-safe equal and not equal operators in mysql
19750 Views
Null safe equals operator <=> 
<=> Operator is used to compare NULL values with the fields. If normal =(equals) Operators return NULL if one of the comparison value is NULL. With <=> operator returns true or false. <=> Operator is same as IS NULL.
Example
SELECT NULL = NULL,
       NULL <=> NULL,
       NULL IS NULL;
Output 
Null safe not equals operator [NOT <=>] 
NOT <=> Operator is used to compare NULL values with the fields. If normal != or <> (not equals) Operators return NULL if one of the comparison value is NULL. With NOT <=> operator returns true or false. NOT <=> Operator is same as IS NOT NULL.
Example
SELECT NULL != NULL,
       NOT NULL <=> NULL,
       NULL IS NOT NULL;
Output 
Previous Topics
Previous lessons of current book.
INFORMATION_SCHEMA Db of MySQL
INFORMATION_SCHEMA Db of MySQL
INFORMATION_SCHEMA Db of MySQL
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details