Convert a value into its binary string representation.
SELECT BINARY “W3Schools.com”; |
The BINARY function converts a value to a binary string.
Note: This function performs the same operation as using CAST(value AS BINARY).
BINARY value |
Parameter |
Description |
number |
Required: The value that will be converted. |
Works in: |
From MySQL version 4.0 |
In MySQL, a character-by-character comparison of “HELLO” and “hello” would return 1 because, at a basic comparison level, they are considered equivalent.
SELECT “HELLO” = “hello”; |
In MySQL, a byte-by-byte comparison of “HELLO” and “hello” would return 0 because, at the byte level, they are not considered equivalent.
SELECT BINARY “HELLO” = “hello”; |