BIN()

Overview

Returns a string representation of the binary value of the given BIGINT number.

USAGE

BIN(integer)

Argument Name

Description

integer

The number to convert to binary

DETAILS

BIN() is a string function that returns a string representation of a numerical argument transformed into binary.

A binary value is a number represented in the base-2 numeral system that makes use of only two symbols: 0 and 1.

The returned value is always an integer, with floating point values being transformed into an integer using a floor function.

The returned values can be up to 64 bits (the size of a BIGINT).

Negative input values are returned as two's complement positive values (where the highest bit being set indicates that the number is negative).

A NULL is returned if the argument is NULL.

SYNONYMS

SCHEMA

PARAMETERS

SKYSQL

PRIVILEGES

EXAMPLES

SELECT BIN(5), BIN(42);
+--------+---------+
| BIN(5) | BIN(42) |
+--------+---------+
| 101    | 101010  |
+--------+---------+
SELECT BIN(-1);
+------------------------------------------------------------------+
| BIN(-1)                                                          |
+------------------------------------------------------------------+
| 1111111111111111111111111111111111111111111111111111111111111111 |
+------------------------------------------------------------------+

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