MySQL | COMPRESS( ) Function Last Updated : 30 Nov, 2022 Comments Improve Suggest changes Like Article Like Report The MySQL COMPRESS() function is used for the compression of a string. The value returned by the COMPRESS() function is a binary string. The COMPRESS() function stores non-empty strings as a four-byte length of the uncompressed string, which is then followed by the compressed string. If the string ends with space, a "." character is added to the string. Also, it should be noted that empty strings are stored as empty strings. The COMPRESS() function accepts one parameter which is the string to be compressed. Syntax: COMPRESS(string_to_compress) Parameters Used: string_to_compress - It is used to specify the plain text string that is to be compressed. Return Value: The COMPRESS function in MySQL returns a compressed string. Supported Versions of MySQL: MySQL 5.7MySQL 5.6MySQL 5.5MySQL 5.1MySQL 5.0MySQL 4.1 Example-1: Implementing COMPRESS function on a string. SELECT COMPRESS('geeksforgeeks'); Example-2: Implementing COMPRESS function on a string which has a combination of characters and integers. SELECT COMPRESS('geeksforgeeks123'); Output: \0\0\0x?KOM-?N?/JOM?.642\06?? Example-3: Implementing COMPRESS function on a string and returning the length of the string after compression. SELECT COMPRESS('geeksforgeeks'), LENGTH(COMPRESS('geeksforgeeks')); Output: \0\0\0x?KOM?.N?/J?\0%?f 22 Example-4: Implementing COMPRESS function on a NULL string and returning the length of the string after compression. SELECT COMPRESS(NULL), LENGTH(COMPRESS(NULL)); Output: NULL NULL Comment More infoAdvertise with us Next Article MySQL | COMPRESS( ) Function S Shubrodeep Banerjee Follow Improve Article Tags : SQL mysql SQLmysql Similar Reads MySQL COALESCE() Function The MySQL COALESCE() function returns the first non-null value in a list of expressions. COALESCE function in MySQLThe COALESCE function in MySQL is used to get the first non-null value from a list of expressions. If all the values in the list are evaluated to NULL, then the COALESCE() function retu 2 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 | 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 PLSQL | COMPOSE Function The string in PL/SQL is actually a sequence of characters with an optional size specification. The characters could be numeric, letters, blank, special characters or a combination of all. The Compose Function in PLSQL is used to return a Unicode string. The unistring values that can be combined with 1 min read PLSQL | DECOMPOSE Function The DECOMPOSE Function in PLSQL is used for accepting a string and returning its Unicode string. The DECOMPOSE Function is generally the opposite of the COMPOSE function. The DECOMPOSE function is valid only for Unicode characters and it returns a Unicode string after decomposition in the same chara 1 min read MySQL | BINARY Function 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 Parame 1 min read ELT() Function in MySQL In this article, we are going to cover ELT function with examples. In ELT function, number field will state that how many strings will be there. ELT function in MySQL is used to returns the string which is at index number specified in the argument list. In this function there is number field and str 1 min read CONCAT() function in MySQL CONCAT() function in MySQL is used to concatenating the given arguments. It may have one or more arguments. If all arguments are nonbinary strings, the result is a nonbinary string. If the arguments include any binary strings, the result is a binary string. If a numeric argument is given then it is 2 min read PLSQL | DUMP Function The PLSQL DUMP function is used to return a varchar2 value that contains the datatype code, the length in bytes, and the internal representation of the expression. The PLSQL DUMP function accepts an expression as a parameter, if the expression value is NULL, then the DUMP function returns NULL. Synt 2 min read Like