Home >Database >Mysql Tutorial >What is the MySQL NULL-safe equality operator and how is it different from the comparison operator?
MySQL NULL safe equals operator, equivalent to the standard SQL IS NOT DISTINCT FROM operator, performs equality comparisons similar to the = operator. Its symbol is . When we have NULL as two operands, it performs differently than the comparison operator. Consider the following example to understand NULL-safe operators and their differences from comparison operators -
mysql> Select 50 <=> 50, NULL <=> NULL, 100 <=> NULL; +-----------+---------------+--------------+ | 50 <=> 50 | NULL <=> NULL | 100 <=> NULL | +-----------+---------------+--------------+ | 1 | 1 | 0 | +-----------+---------------+--------------+ 1 row in set (0.00 sec) mysql> Select 50 = 50, NULL = NULL, 100 = NULL; +---------+-------------+------------+ | 50 = 50 | NULL = NULL | 100 = NULL | +---------+-------------+------------+ | 1 | NULL | NULL | +---------+-------------+------------+ 1 row in set (0.00 sec)
The above is the detailed content of What is the MySQL NULL-safe equality operator and how is it different from the comparison operator?. For more information, please follow other related articles on the PHP Chinese website!