Bit-Value Literals 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. Bit-value literals are written using  b’ val ’  or  0b val  notation.  val  is a binary value written using zeros and ones. Lettercase of any leading  b  does not matter. A leading  0b  is case-sensitive and cannot be written as 0B . A bit-value literal may have an optional character set introducer and  COLLATE  clause, to designate it as a string that uses a particular character set and collation: In numeric contexts, MySQL treats a bit literal like an integer. To ensure numeric treatment of a bit literal, use it in numeric context. Ways to do this include adding 0 or using  CAST(... AS UNSIGNED) . For example, a bit literal assigned to a user-defined variable is a binary string by default. To assign the value as a number, use it in numeric context: The examples use  b’ val ’  notation, but  0b val  notation permits introducers as well. For information about introducers, see Section 10.3.8, “Character Set Introducers” . Examples: By default, a bit-value literal is a binary string: Illegal bit-value literals: Legal bit-value literals: +----------+----------+ | HEX(@v1) | HEX(@v2) | +----------+----------+ | BCD | 0BCD | +----------+----------+ mysql>  SELECT HEX(@v1), HEX(@v2); 9.1.5 Bit-Value Literals b’2’ (2 is not a binary digit) 0B01 (0B must be written as 0b) b’01’ B’01’ 0b01 mysql>  SELECT b’1000001’, CHARSET(b’1000001’); mysql>  SELECT 0b1100001, CHARSET(0b1100001); +------------+---------------------+ | b’1000001’ | CHARSET(b’1000001’) | +------------+---------------------+ | A | binary | +------------+---------------------+ +-----------+--------------------+ | 0b1100001 | CHARSET(0b1100001) | +-----------+--------------------+ | a | binary | +-----------+--------------------+ [_ charset_name ] b’ val ’ [COLLATE  collation_name ] SELECT _latin1 b’1000001’; SELECT _utf8 0b1000001 COLLATE utf8_danish_ci; mysql>  SET @v1 = b’1100001’; 1867