Skip to content
Related Articles

Related Articles

MySQL | UNCOMPRESS( ) Function
  • Last Updated : 17 Feb, 2021

The MySQL UNCOMPRESS() function is used for uncompressing a string and bring it back to its original state. It is used on a string that has been compressed using the COMPRESSED() function. 

The MySQL UNCOMPRESS() function returns empty strings if the compressed string is an empty string. It accepts one parameter which is the compressed string to be uncompressed. 

Syntax: 
 

UNCOMPRESS(string);

Parameters Used: 

string – It is used to specify the compressed string that is to be uncompressed. 



Return Value: 
The UNCOMPRESS() function in MySQL returns the original string after uncompressing a compressed string. 

Supported Versions of MySQL: 

 

  • MySQL 5.7
  • MySQL 5.6
  • MySQL 5.5
  • MySQL 5.1
  • MySQL 5.0
  • MySQL 4.1

Example-1: Implementing UNCOMPRESS function on a string. 
 

SELECT  
UNCOMPRESS(COMPRESS('geeksforgeeks')); 

Output: 

geeksforgeeks 

Example-2: Implementing UNCOMPRESS function on a string which has a combination of characters and integers. 

SELECT 
UNCOMPRESS(COMPRESS('geeksforgeeks123')); 

Output: 

geeksforgeeks123 

Example-3: Implementing COMPRESS function on a NULL string and returning the length of the string after compression. 

SELECT  
UNCOMPRESS(COMPRESS(NULL)); 

Output: 

NULL 
My Personal Notes arrow_drop_up
Recommended Articles
Page :