MySQL BINARY Function
Definition and Usage
The BINARY function converts a value to a binary string.
Syntax
  BINARY valueParameter Values
| Parameter | Description | 
|---|---|
| value | Required. The value to convert | 
Note
- The BINARY function is equivalent to using CAST(value AS BINARY).
Technical Details
| Works in: | MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0, MySQL 3.23 | 
|---|
More Examples
Example
Here MySQL performs a character-by-character comparison of "HELLO" and "hello" and return 1 (because on a character-by-character basis, they are equivalent):
  SELECT "HELLO" = "hello";
Try it Yourself »
Example
Here MySQL performs a byte-by-byte comparison of "HELLO" and "hello" and return 0 (because on a byte-by-byte basis, they are NOT equivalent):
  SELECT BINARY "HELLO" = "hello";
Try it Yourself »

