
- 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 display MySQL bit values in printable form?
Actually, Bit values are returned as binary values but we can also display them in the printable form with the help of following −
By adding 0
We can display Bit values in printable form by adding 0 to them. Following the example from the bit_testing table can be used to understand it −
mysql> Select bittest+0 from bit_testing; +-----------+ | bittest+0 | +-----------+ | 170 | | 5 | | 5 | +-----------+ 3 rows in set (0.00 sec)
By using conversion function BIN(),OCT(),HEX()
We can also display Bit values in printable form by using BIN() conversion function. Following the example from the bit_testing table can be used to understand it −
mysql> Select BIN(bittest+0) from bit_testing; +----------------+ | BIN(bittest+0) | +----------------+ | 10101010 | | 101 | | 101 | +----------------+ 3 rows in set (0.00 sec) mysql> Select OCT(bittest+0) from bit_testing; +----------------+ | OCT(bittest+0) | +----------------+ | 252 | | 5 | | 5 | +----------------+ 3 rows in set (0.05 sec) mysql> Select HEX(bittest+0) from bit_testing; +----------------+ | HEX(bittest+0) | +----------------+ | AA | | 5 | | 5 | +----------------+ 3 rows in set (0.00 sec)
- Related Articles
- How can we convert TIME and DATETIME values to numeric form in MySQL?
- How can we update values in a MySQL table?
- How can we enter BOOLEAN values in MySQL statement?
- How to display the bit(1) fields in MySQL?
- How can we update any value in MySQL view as we can update the values in MySQL table?
- Java Program to display printable characters
- How can we specify default values in MySQL INSERT statement?
- Can we store CSS color values in MySQL?
- How can we get the values of a JProgressBar Component and display in Console?
- How to display xtable values in scientific form in R?
- In MySQL, how can we display time in other format specified by the user?
- How can we calculate the difference between two time values in MySQL?
- How can we update the values in one MySQL table by using the values of another MySQL table?
- In MySQL, how can we display the date in other format specified by the user?
- How can we enter numeric values as Hexadecimal (HEX) number in MySQL statement?

Advertisements