MySQL Tutorial/Comparison Functions Operators/Not equal

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

Compare string value using the Not equal operator

   <source lang="sql">

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


Data type conversion in Not equal operator

   <source lang="sql">

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


Not equal: <> or !=

   <source lang="sql">

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


SELECT .01 <> "0.01";

   <source lang="sql">

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


String comparisons are not case sensitive

   <source lang="sql">

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></source>