bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/SQL/SQL References
SQL•SQL References

MySQL BINARY Function

Concept visual

MySQL BINARY Function

Pointer walk
two pointers
leftright102132436485116
left=0
right=6
1
3

Start at both ends

Example

Convert a value to a binary string:

SELECT BINARY "W3Schools.com";

Definition and Usage

The BINARY function converts a value to a binary string.

This function is equivalent to using

CAST(value AS BINARY).

Syntax

Binary

value

Parameter Values

Parameter

Description value

Required. The value to convert

Technical Details

Works in:

From MySQL 4.0

More Examples

Example

Formula

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";

Example

Formula

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";

Previous

❮ MySQL Functions

Next

Previous

MySQL BIN() Function

Next

MySQL CASE Function