MySQL Tutorial/Comparison Functions Operators/Not equal

Материал из SQL эксперт
Перейти к: навигация, поиск

Compare string value using the Not equal operator

mysql>
mysql> SELECT "AB" <> "ABC";
+---------------+
| "AB" <> "ABC" |
+---------------+
|             1 |
+---------------+
1 row in set (0.00 sec)
mysql>


Data type conversion in Not equal operator

mysql>
mysql> SELECT ".01" <> "0.01";
+-----------------+
| ".01" <> "0.01" |
+-----------------+
|               1 |
+-----------------+
1 row in set (0.00 sec)


Not equal: <> or !=

mysql>
mysql>
mysql> SELECT 1 <> 2;
+--------+
| 1 <> 2 |
+--------+
|      1 |
+--------+
1 row in set (0.00 sec)
mysql>
mysql>
mysql>


SELECT .01 <> "0.01";

mysql>
mysql>
mysql>
mysql> SELECT .01 <> "0.01";
+---------------+
| .01 <> "0.01" |
+---------------+
|             0 |
+---------------+
1 row in set (0.00 sec)
mysql>


String comparisons are not case sensitive

mysql>
mysql> SELECT "AB" <> "ab";
+--------------+
| "AB" <> "ab" |
+--------------+
|            0 |
+--------------+
1 row in set (0.00 sec)
mysql>
mysql> SELECT "AB" = "ab";
+-------------+
| "AB" = "ab" |
+-------------+
|           1 |
+-------------+
1 row in set (0.00 sec)
mysql>