MySQL | UNCOMPRESSED_LENGTH( ) Function

The MySQL UNCOMPRESSED_LENGTH() function is used for returning the length of the string before it had been compressed. It is used on a string that has been compressed using the COMPRESSED() function.

The MySQL UNCOMPRESSED_LENGTH() function returns NULL if the compressed string is a NULL string. It accepts one parameter which is the compressed string whose length needs to be calculated.

Syntax:



UNCOMPRESSED_LENGTH(compressed_string);

Parameters Used:

compressed_string – It is used to specify the compressed string whose length needs to be calculated.

Return Value:
The UNCOMPRESSED_LENGTH() function in MySQL returns the length of 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 UNCOMPRESSED_LENGTH() function on a string.

SELECT  
UNCOMPRESS(COMPRESS('geeskforgeeks')); 

Output:

13 

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

SELECT 
UNCOMPRESS(COMPRESS('geeskforgeeks123')); 

Output:

16 

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

SELECT
UNCOMPRESSED_LENGTH(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.