MySQL Tutorial/Cast Functions Operators/BINARY

Материал из SQL эксперт
Версия от 09:53, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

BINARY casts the string to a binary string

BINARY causes the comparison to be case sensitive.

BINARY also causes trailing spaces to be significant.

BINARY str is shorthand for CAST(str AS BINARY).



mysql>
mysql> SELECT "a" = "A";
+-----------+
| "a" = "A" |
+-----------+
|         1 |
+-----------+
1 row in set (0.00 sec)
mysql> SELECT BINARY "a" = "A";
+------------------+
| BINARY "a" = "A" |
+------------------+
|                0 |
+------------------+
1 row in set (0.00 sec)
mysql> SELECT "a" = "a ";
+------------+
| "a" = "a " |
+------------+
|          1 |
+------------+
1 row in set (0.00 sec)
mysql> SELECT BINARY "a" = "a ";
+-------------------+
| BINARY "a" = "a " |
+-------------------+
|                 0 |
+-------------------+
1 row in set (0.00 sec)
mysql>