" means "safe equal" and is a comparison operator, similar to the "=" equal operator, but "<=>" can be used to determine NULL values: when two operands When both are NULL, the return value is 1 instead of NULL; and when one operand is NULL, the return value is 0 instead of NULL."/> " means "safe equal" and is a comparison operator, similar to the "=" equal operator, but "<=>" can be used to determine NULL values: when two operands When both are NULL, the return value is 1 instead of NULL; and when one operand is NULL, the return value is 0 instead of NULL.">

Home  >  Article  >  Database  >  What does <=> mean in mysql

What does <=> mean in mysql

青灯夜游
青灯夜游Original
2022-01-05 15:20:319357browse

In mysql, "96b4fef55684b9312718d5de63fb7121" means "safe equal". It is a comparison operator, similar to the "=" equal operator, but "96b4fef55684b9312718d5de63fb7121" 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.

What does <=> mean in mysql

The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.

Safe equals operator (<span style="font-size: 18px;">96b4fef55684b9312718d5de63fb7121</span>)

The

96b4fef55684b9312718d5de63fb7121 operator is similar to the = equals operator, but 96b4fef55684b9312718d5de63fb7121 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 96b4fef55684b9312718d5de63fb7121 to make an equal judgment

mysql> SELECT 1<=>0,&#39;2&#39;<=>2,2<=>2,&#39;0.02&#39;<=>0,&#39;b&#39;<=>&#39;b&#39;,(1+3) <=> (2+1),NULL<=>NULL;
+-------+---------+-------+------------+-----------+-----------------+-------------+
| 1<=>0 | &#39;2&#39;<=>2 | 2<=>2 | &#39;0.02&#39;<=>0 | &#39;b&#39;<=>&#39;b&#39; | (1+3) <=> (2+1) | NULL<=>NULL |
+-------+---------+-------+------------+-----------+-----------------+-------------+
|     0 |       1 |     1 |          0 |         1 |               0 |           1 |
+-------+---------+-------+------------+-----------+-----------------+-------------+
1 row in set (0.00 sec)

As you can see from the result,

<=> ; has a similar function to = when performing comparison operations. The only difference is that 96b4fef55684b9312718d5de63fb7121 can be used to judge NULL, both of which are The return value is 1 when NULL.

[Related recommendations:

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn