The BINARY function converts a value to a binary string.
This function is equivalent to using CAST(value AS BINARY).
BINARY
value
Parameter | Description |
---|---|
value | Required. The value to convert |
Works in: | From MySQL 4.0 |
---|
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 »
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 »
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!