Bit-Field Values : Bit « Data Types « MySQL Tutorial






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)








10.2.Bit
10.2.1.BIT type column
10.2.2.Bit-Field Values
10.2.3.Bit Functions
10.2.4.Bitwise OR(|): The result is an unsigned 64-bit integer
10.2.5.Bitwise AND(&): The result is an unsigned 64-bit integer.
10.2.6.Bitwise XOR(^): The result is an unsigned 64-bit integer
10.2.7.Shifts a number to the left (<<): The result is an unsigned 64-bit integer.
10.2.8.Shifts a number to the right:>> (The result is an unsigned 64-bit integer.)
10.2.9.Invert all bits :~ (The result is an unsigned 64-bit integer.)
10.2.10.BIT_COUNT(N)