GNU Info

Info Node: (mysql.info)Case Sensitivity Operators

(mysql.info)Case Sensitivity Operators


Prev: String comparison functions Up: String functions
Enter node , (file) or (file)node

Case Sensitivity
................

``BINARY''
     The `BINARY' operator casts the string following it to a binary
     string.  This is an easy way to force a column comparison to be
     case sensitive even if the column isn't defined as `BINARY' or
     `BLOB':
          mysql> select "a" = "A";
                  -> 1
          mysql> select BINARY "a" = "A";
                  -> 0

     `BINARY' was introduced in MySQL Version 3.23.0.

     Note that in some context MySQL will not be able to use the index
     efficiently when you cast an indexed column to `BINARY'.

If you want to compare a blob case-insensitively you can always convert
the blob to upper case before doing the comparison:

     SELECT 'A' LIKE UPPER(blob_col) FROM table_name;

We plan to soon introduce casting between different character sets to
make string comparison even more flexible.


automatically generated by info2www version 1.2.2.9