COMPRESS
Descriptionβ
The COMPRESS function is used to compress strings or values into binary data. The compressed data can be decompressed using the UNCOMPRESS function.
Syntaxβ
COMPRESS(<uncompressed_str>)
Parametersβ
Parameters | Description |
---|---|
<uncompressed_str> | Uncompressed raw string, parameter type is varchar or string |
Return Valueβ
The return string is of the same type as the input uncompressed_str
The return string is an unreadable compressed byte stream.
Special cases:
uncompressed_str
Return empty string(''
) when the input is empty string(''
)
Exampleβ
select uncompress(compress('abc'));
+-----------------------------+
| uncompress(compress('abc')) |
+-----------------------------+
| abc |
+-----------------------------+
select compress('');
+--------------+
| compress('') |
+--------------+
| |
+--------------+