简体   繁体   中英

What does <=> operator mean, sql?

I came accross the sql query where the <=> operator is put. What does <=> operator mean?

SELECT STR_ID, TEX_TEXT AS STR_DES_TEXT, IF( EXISTS( SELECT * FROM SEARCH_TREE AS SEARCH_TREE2 WHERE       SEARCH_TREE2.STR_ID_PARENT <=> SEARCH_TREE.STR_ID LIMIT 1 ), 1, 0) AS DESCENDANTS FROM SEARCH_TREE

This sql is of MySQL type.

When in doubt, read the documentation :

<=> is a NULL-safe equal. This operator performs an equality comparison like the = operator, but returns 1 rather than NULL if both operands are NULL, and 0 rather than NULL if one operand is NULL.

Null safe equal operator,it returns 1 if boths operands are null.

http://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html#operator_equal-to

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM