
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How can we enter characters as a BINARY number in MySQL statement?
Following are the two approaches with the help of which we can enter characters as a BINARY number −
By prefix ‘B’
In this approach we need to quote binary numbers within single quotes with a prefix of B. Then BINARY number string will be automatically converted into a character string.
Example
mysql> Select B'01000001'; +-------------+ | B'01000001' | +-------------+ | A | +-------------+ 1 row in set (0.00 sec)
By prefix 0b
In this approach, we need to write BINARY numbers without any quotes with a prefix of 0b. Then BINARY number string will be automatically converted into a character string.
Example
mysql> Select 0b01000001; +------------+ | 0b01000001 | +------------+ | A | +------------+ 1 row in set (0.00 sec)
- Related Articles
- How can we enter characters as Hexadecimal (HEX) number in MySQL statement?
- How can we enter numerical values as a BINARY number in MySQL statement?
- How can we enter numeric values as Hexadecimal (HEX) number in MySQL statement?
- How can we enter BOOLEAN values in MySQL statement?
- How can we escape special characters in MySQL statement?
- How can we use MySQL SELECT statement to count number of rows in a table?
- In MySQL, how we can write Multiple-line statement?
- How can we use a MySQL subquery with INSERT statement?
- How can we run a MySQL statement without termination semicolon?
- How can we specify default values in MySQL INSERT statement?
- In MySQL, how we can get the corresponding string representation of the binary value of a number?
- How can we use SIGNAL statement with MySQL triggers?
- How can we get some last number of characters from the data stored in a MySQL table’s column?
- How can we get some starting number of characters from the data stored in a MySQL table’s column?
- Can we use SELECT NULL statement in a MySQL query?

Advertisements