Bit-field values can be written using
b' notation.
value'value is a binary value written using
zeros and ones.
Bit-field notation is convenient for specifying values to be
assigned to BIT columns:
mysql>CREATE TABLE t (b BIT(8));mysql>INSERT INTO t SET b = b'11111111';mysql>INSERT INTO t SET b = b'1010';+------+----------+----------+----------+ | b+0 | BIN(b+0) | OCT(b+0) | HEX(b+0) | +------+----------+----------+----------+ | 255 | 11111111 | 377 | FF | | 10 | 1010 | 12 | A | +------+----------+----------+----------+

User Comments
mysql> INSERT INTO t SET b = b'0101';
3 rows in set (0.00 sec)Query OK, 1 row affected (0.03 sec)
mysql> select b+0, BIN(b+0), OCT(b+0), HEX(b+0) from t;
Notice the result and way to get the shown table. also notice 0101 is shown in BINARY as 101 and not 0101.
Add your own comment.