MySQL Tutorial/Encryption Compression Functions/COMPRESS
Содержание
COMPRESS(string_to_compress) compresses a string and returns the result as a binary string
mysql>
mysql> SELECT LENGTH(COMPRESS(REPEAT("a",1000)));
+------------------------------------+
| LENGTH(COMPRESS(REPEAT("a",1000))) |
+------------------------------------+
| 21 |
+------------------------------------+
1 row in set (0.02 sec)
mysql>
SELECT LENGTH(COMPRESS(""));
mysql>
mysql> SELECT LENGTH(COMPRESS(""));
+----------------------+
| LENGTH(COMPRESS("")) |
+----------------------+
| 0 |
+----------------------+
1 row in set (0.00 sec)
mysql>
SELECT LENGTH(COMPRESS("a"));
mysql>
mysql> SELECT LENGTH(COMPRESS("a"));
+-----------------------+
| LENGTH(COMPRESS("a")) |
+-----------------------+
| 13 |
+-----------------------+
1 row in set (0.00 sec)
mysql>
SELECT LENGTH(COMPRESS(REPEAT("a",16)));
mysql>
mysql> SELECT LENGTH(COMPRESS(REPEAT("a",16)));
+----------------------------------+
| LENGTH(COMPRESS(REPEAT("a",16))) |
+----------------------------------+
| 15 |
+----------------------------------+
1 row in set (0.00 sec)
mysql>