MySQL BINARY Function
THE WORLD'S LARGEST WEB DEVELOPER SITE

MySQL BINARY Function

❮ MySQL Functions

Example

Convert a value to a binary string:

SELECT BINARY "W3Schools.com";
Try it Yourself »

Definition and Usage

The BINARY function converts a value to a binary string.

Syntax

BINARY value

Parameter Values

Parameter Description
value Required. The value to convert

Note

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 »

❮ MySQL Functions