Mega Code Archive

 
Categories / MySQL Tutorial / Data Types
 

BIT type column

M indicates the number of bits per value, from 1 to 64. The default is 1 if M is omitted. 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.00 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.02 sec) mysql> mysql> drop table t; Query OK, 0 rows affected (0.00 sec)