Igor Savinkin
Igor Savinkin

Reputation: 6267

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.

Upvotes: 0

Views: 186

Answers (2)

tadman
tadman

Reputation: 211600

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.

Upvotes: 6

Mihai
Mihai

Reputation: 26784

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

Upvotes: 3

Related Questions