Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "<=>" in MySQL mean?

What does <=> in MySQL mean and do?

like image 515
kuba Avatar asked Dec 29 '10 12:12

kuba


People also ask

What is meaning of <> in database?

It (<>) is a function that is used to compare values in database table. != (Not equal to) functions the same as the <> (Not equal to) comparison operator. Follow this answer to receive notifications.

What is meant by query in MySQL?

In relational database management systems, a query is any command used to retrieve data from a table. In Structured Query Language (SQL), queries are almost always made using the SELECT statement.

What is the meaning of this symbol in SQL?

<> this symbol means not equal in sql. Basically <> this symbol used in sql when we write Non-Equi join query.

What is difference between <> and !=?

Difference between SQL Not Equal Operator <> and != to do inequality test between two expressions. Both operators give the same output. The only difference is that '<>' is in line with the ISO standard while '!= ' does not follow ISO standard.


1 Answers

The manual says it all:

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.

mysql> select NULL <=> NULL;
+---------------+
| NULL <=> NULL |
+---------------+
|             1 |
+---------------+
1 row in set (0.00 sec)

mysql> select NULL = NULL;
+-------------+
| NULL = NULL |
+-------------+
|        NULL |
+-------------+
1 row in set (0.00 sec)

mysql> select NULL <=> 1;
+------------+
| NULL <=> 1 |
+------------+
|          0 |
+------------+
1 row in set (0.00 sec)

mysql> select NULL = 1;
+----------+
| NULL = 1 |
+----------+
|     NULL |
+----------+
1 row in set (0.00 sec)

mysql> 
like image 91
codaddict Avatar answered Sep 21 '22 09:09

codaddict