In mysql, "<=>" means "safe equal". It is a comparison operator, similar to the "=" equal operator, but "<=>" can be used To judge the NULL value: when both operands are NULL, the return value is 1 instead of NULL; and when one operand is NULL, the return value is 0 instead of NULL.
The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.
Safe equals operator (<span style="font-size: 18px;"><=></span>
)
<=>
operator is similar to the =
equals operator, but <=>
can be used to determine NULL values, specific syntax The rules are:
When both operands are NULL, the return value is 1 instead of NULL;
And when a When the operand is NULL, the return value is 0 instead of NULL.
##Example: Use <=> to make an equal judgment
mysql> SELECT 1<=>0,'2'<=>2,2<=>2,'0.02'<=>0,'b'<=>'b',(1+3) <=> (2+1),NULL<=>NULL; +-------+---------+-------+------------+-----------+-----------------+-------------+ | 1<=>0 | '2'<=>2 | 2<=>2 | '0.02'<=>0 | 'b'<=>'b' | (1+3) <=> (2+1) | NULL<=>NULL | +-------+---------+-------+------------+-----------+-----------------+-------------+ | 0 | 1 | 1 | 0 | 1 | 0 | 1 | +-------+---------+-------+------------+-----------+-----------------+-------------+ 1 row in set (0.00 sec)
<=> ; has a similar function to
= when performing comparison operations. The only difference is that
<=> can be used to judge NULL, both of which are The return value is 1 when NULL.
mysql video tutorial]
The above is the detailed content of What does <=> mean in mysql. For more information, please follow other related articles on the PHP Chinese website!