Boolean Literals mysql>  SET @v2 = b’1100001’+0; mysql>  SET @v3 = CAST(b’1100001’ AS UNSIGNED); mysql>  SELECT @v1, @v2, @v3; +------+------+------+ | @v1 | @v2 | @v3 | +------+------+------+ | a | 97 | 97 | +------+------+------+ +--------------+-------------+ | CHARSET(b’’) | LENGTH(b’’) | +--------------+-------------+ | binary | 0 | +--------------+-------------+ +-------+ | b’’+0 | +-------+ | 0 | +-------+ mysql>  SELECT b’’+0; mysql>  SELECT CHARSET(b’’), LENGTH(b’’); An empty bit value ( b’’ ) evaluates to a zero-length binary string. Converted to a number, it produces 0: Bit-value notation is convenient for specifying values to be assigned to  BIT  columns: Bit values in result sets are returned as binary values, which may not display well. To convert a bit value to printable form, use it in numeric context or use a conversion function such as  BIN()  or  HEX() . High-order 0 digits are not displayed in the converted value. mysql>  CREATE TABLE t (b BIT(8)); mysql>  INSERT INTO t SET b = b’11111111’; mysql>  INSERT INTO t SET b = b’1010’; mysql>  INSERT INTO t SET b = b’0101’; mysql>  SELECT b+0, BIN(b), OCT(b), HEX(b) FROM t; mysql>  SET @v1 = b’000010101’ | b’000101010’; mysql>  SET @v2 = _binary b’000010101’ | _binary b’000101010’; mysql>  SELECT HEX(@v1), HEX(@v2); +------+----------+--------+--------+ | b+0 | BIN(b) | OCT(b) | HEX(b) | +------+----------+--------+--------+ | 255 | 11111111 | 377 | FF | | 10 | 1010 | 12 | A | | 5 | 101 | 5 | 5 | +------+----------+--------+--------+ +----------+----------+ | HEX(@v1) | HEX(@v2) | +----------+----------+ | 3F | 003F | +----------+----------+ For bit literals, bit operations are considered numeric context, but bit operations permit numeric or binary string arguments in MySQL 8.0 and higher. To explicitly specify binary string context for bit literals, use a _binary  introducer for at least one of the arguments: The displayed result appears similar for both bit operations, but the result without  _binary  is a  BIGINT value, whereas the result with  _binary  is a binary string. Due to the difference in result types, the displayed values differ: High-order 0 digits are not displayed for the numeric result. 9.1.6 Boolean Literals 1868