Bit-Operation Incompatibilities with MySQL 5.7 • >> Shifts a longlong ( BIGINT ) number or binary string to the right. The result type depends on whether the bit argument is evaluated as a binary string or number: Bits shifted off the end of the value are lost without warning, regardless of the argument type. In particular, if the shift count is greater or equal to the number of bits in the bit argument, all bits in the result are 0. For more information, see the introductory discussion in this section. If a bit shift is invoked from within the  mysql  client, binary string results display using hexadecimal notation, depending on the value of the  --binary-as-hex . For more information about that option, see Section 4.5.1, “mysql — The MySQL Command-Line Client” . Invert all bits. The result type depends on whether the bit argument is evaluated as a binary string or number: For more information, see the introductory discussion in this section. If bitwise inversion is invoked from within the  mysql  client, binary string results display using hexadecimal notation, depending on the value of the  --binary-as-hex . For more information about that option, see Section 4.5.1, “mysql — The MySQL Command-Line Client” . Returns the number of bits that are set in the argument  N  as an unsigned 64-bit integer, or  NULL  if the argument is  NULL . 2270 • BIT_COUNT( N ) •Binary-string evaluation occurs when the bit argument has a binary string type, and is not a hexadecimal literal, bit literal, or  NULL  literal. Numeric evaluation occurs otherwise, with argument conversion to an unsigned 64-bit integer as necessary. •Binary-string evaluation produces a binary string of the same length as the bit argument. Numeric evaluation produces an unsigned 64-bit integer. • ~ •Binary-string evaluation produces a binary string of the same length as the bit argument. Numeric evaluation produces an unsigned 64-bit integer. •Binary-string evaluation occurs when the bit argument has a binary string type, and is not a hexadecimal literal, bit literal, or  NULL  literal. Numeric evaluation occurs otherwise, with argument conversion to an unsigned 64-bit integer as necessary. mysql>  SELECT 4 >> 2; -> 1 mysql>  SELECT HEX(_binary X’00FF00FF00FF’ >> 8); -> ’0000FF00FF00’ mysql>  SELECT 5 & ~1; -> 4 mysql>  SELECT HEX(~X’0000FFFF1111EEEE’); -> ’FFFF0000EEEE1111’ mysql>  SELECT BIT_COUNT(64), BIT_COUNT(BINARY 64); -> 1, 7