Here are the two ways in which we can enter binary numeric values-
This method requires quoting the binary number within single quotes with the B prefix, and then the BINARY numeric string will be automatically converted to a numeric value based on the expression context.
mysql> Select B'1110'+0; +-----------+ | B'1110'+0 | +-----------+ | 14 | +-----------+ 1 row in set (0.00 sec)
In this method we need to write the BINARY number without quotes with prefix 0b. The BINARY numeric string will then be automatically converted to a numeric value based on the expression context.
mysql> Select 0b1110+0; +----------+ | 0b1110+0 | +----------+ | 14 | +----------+ 1 row in set (0.00 sec)
The above is the detailed content of How do we enter a value as a BINARY number in a MySQL statement?. For more information, please follow other related articles on the PHP Chinese website!