MySQL Tutorial/Cast Functions Operators/BINARY — различия между версиями

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

Текущая версия на 09:53, 26 мая 2010

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>