Mega Code Archive

 
Categories / MySQL Tutorial / Data Types
 

Bit-Field Values

bit-field values can be written using b'value' notation. 'value is a binary value written using zeros and ones. mysql> mysql> CREATE TABLE t (b BIT(8)); Query OK, 0 rows affected (0.02 sec) mysql> mysql> INSERT INTO t SET b = b'11111111'; Query OK, 1 row affected (0.01 sec) mysql> mysql> INSERT INTO t SET b = b'1010'; Query OK, 1 row affected (0.00 sec) mysql> mysql> select * from t; +------+ | b    | +------+ | Ã¿    | |     | +------+ 2 rows in set (0.00 sec) mysql> mysql> drop table t; Query OK, 0 rows affected (0.00 sec)