Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

sql
mysql
bin
communitycreator

What is BIN() in SQL?

harris910

The BIN() function returns a binary representation of the decimal value, given as a parameter, in the form of a string.

Figure 1 shows a visual representation of the BIN() function.

Figure 1: Visual representation of BIN() function

Syntax

BIN(value)

Parameter

The BIN() function takes the decimal value as a parameter.

Return value

The BIN() function returns a binary representation of the decimal value sent as a parameter in the string form.

It returns NULL if the decimal value is NULL.

Example

-- simple number
SELECT BIN(11);

SELECT BIN(100);

-- NULL
SELECT BIN(NULL);

RELATED TAGS

sql
mysql
bin
communitycreator
RELATED COURSES

View all Courses

Keep Exploring