MySQL | BINARY Function Last Updated : 21 Nov, 2019 Comments Improve Suggest changes Like Article Like Report The MySQL BINARY function is used for converting a value to a binary string. The BINARY function can also be implemented using CAST function as CAST(value AS BINARY). The BINARY function accepts one parameter which is the value to be converted and returns a binary string. Syntax: BINARY value Parameters Used: value - It is used to specify the value to be converted. Return Value: The MySQL BINARY function returns a binary string after converting a value specified by the user. Supported Versions of MySQL: MySQL 5.7 MySQL 5.6 MySQL 5.5 MySQL 5.1 MySQL 5.0 MySQL 4.1 MySQL 4.0 MySQL 3.23 Example-1: Implementing BINARY function to return a binary string. SELECT BINARY('Geeksforgeeks'); Output: Geeksforgeeks Example-2: Character-by-character comparison of two string without using BINARY function. SELECT 'GEEKSFORGEEKS' = 'geeksforgeeks'; Output: 1 Example-3: Byte-by-Byte comparison of two string using BINARY function. SELECT BINARY 'GEEKSFORGEEKS' = 'geeksforgeeks'; Output: 0 Example-4: Byte-by-Byte comparison of two string using BINARY function. SELECT BINARY 'GEEKSFORGEEKS' = 'GEEKSFORGEEKS'; Output: 1 Comment More infoAdvertise with us Next Article MySQL | BINARY Function S Shubrodeep Banerjee Follow Improve Article Tags : SQL mysql SQLmysql Similar Reads MySQL BIN() Function The BIN() function in MySQL converts a decimal number to its binary equivalent. The BIN() function is equivalent to the CONV() function written in the format CONV(number,10,2). In this format, the CONV() function converts the number 'number' from base 10 (decimal) to base 2 (binary). It is important 1 min read MySQL | CONV( ) Function The MySQL CONV() function is used for converting a number from one numeric base system to another. The value returned by the CONV() function is in the form of a string value. It accepts three parameters which are the value to be converted, the current numeric base system and the numeric base system 2 min read MySQL CASE() Function MySQL CASE function is a conditional statement that returns a value when the first condition is met. Once a condition is met, the CASE function does not check for other conditions. If no condition is met it returns the output in ELSE part. CASE Function in MySQLThe CASE Function in MySQL allows usin 4 min read MySQL | CAST( ) Function The MySQL CAST() function is used for converting a value from one datatype to another specific datatype. The CAST() function accepts two parameters which are the value to be converted and the datatype to which the value needs to be converted. The datatypes in which a given value can be converted are 3 min read MySQL | CONVERT( ) Function The MySQL CONVERT() function is used for converting a value from one datatype to a different datatype. The MySQL CONVERT() function is also used for converting a value from one character set to another character set. It accepts two parameters which are the input value and the type to be converted in 2 min read Like