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 DAY() Function in MySQL DAY() function : This function in MySQL is used to return the day of the month for a specified date (a number from 1 to 31). This function equals the DAYOFMONTH() function. Syntax : DAY(date) Parameter : This method accepts a parameter which is illustrated below : date : Specified date to extract th 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 SQL | ENCRYPT Function The SQL Encrypt function is used to encrypt a string using UNIX crypt(). The function is based on Unix crypt() system call, hence it returns NULL on Windows systems. The Encrypt function accepts two parameters which are the string and the salt to be encrypted. The Encrypt function returns a binary s 2 min read MySQL | AES_ENCRYPT ( ) Function The MySQL AES_ENCRYPT function is used for encrypting a string using Advanced Encryption Standard (AES) algorithm. The MySQL AES_ENCRYPT function encodes the data with 128 bits key length but it can be extended up to 256 bits key length. It encrypts a string and returns a binary string. The value re 1 min read PLSQL | BITAND Function The BITAND is an inbuilt function in PLSQL which is used to returns an integer value which is calculated with AND operation of two given input decimal number. Internally these input decimal numbers get converted into binary numbers and then AND operation is performed and results are returned as outp 2 min read BIT_OR() Function in MySQL BIT_OR() function in MySQL is used to return the bitwise OR of all bits in a given expression. It first converts all decimal values into binary values, and then perform bitwise or operation on those binary values. Syntax : BIT_OR(expr) Parameter : This method accepts only one parameter. expr - Input 4 min read Like