BINARY

Overview

Casts strings to binary values.

USAGE

BINARY string

Value Name

Description

string

A string expression

DETAILS

The BINARY operator converts a string data type into a binary data type.

One common reason for such a conversion is to compare character values with uppercase and lowercase letters not being treated as equal.

SYNONYMS

SCHEMA

PARAMETERS

SKYSQL

PRIVILEGES

EXAMPLES

SELECT 'foo' = BINARY 'FOO';
+----------------------+
| 'foo' = BINARY 'FOO' |
+----------------------+
|                    0 |
+----------------------+
SELECT 'foo' = CAST(BINARY 'FOO' AS CHAR);
+------------------------------------+
| 'foo' = CAST(BINARY 'FOO' AS CHAR) |
+------------------------------------+
|                                  1 |
+------------------------------------+
CREATE TABLE binary_example (
  word varchar(32)
);
INSERT INTO binary_example VALUES
  ('Adjust'), ('adjust'),
  ('about'), ('About'),
  ('ABC'), ('abc');
SELECT word
FROM binary_example
ORDER BY BINARY word;
+--------+
| word   |
+--------+
| ABC    |
| About  |
| Adjust |
| abc    |
| about  |
| adjust |
+--------+
SELECT word
FROM binary_example
ORDER BY word;
+--------+
| word   |
+--------+
| ABC    |
| abc    |
| about  |
| About  |
| Adjust |
| adjust |
+--------+

ERROR HANDLING

FEATURE INTERACTION

RESPONSES

DIAGNOSIS

ISO 9075:2016

CHANGE HISTORY

Release Series

History

23.09

  • Present starting in MariaDB Xpand 23.09.1.

6.1

  • Present starting in MariaDB Xpand 6.1.0.

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.1

  • Present starting in MariaDB Xpand 6.1.0.

EXTERNAL REFERENCES