MySQL | UNCOMPRESS( ) Function

The MySQL UNCOMPRESS() function is used for uncompressing a string and bring it back to its original state. It is used on string which have 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 an 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('geeskforgeeks')); 

Output:

geeksforgeeks 

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

SELECT 
UNCOMPRESS(COMPRESS('geeskforgeeks123')); 

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


If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.