MySQL Tutorial/Encryption Compression Functions/COMPRESS — различия между версиями

Материал из SQL эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Текущая версия на 09:53, 26 мая 2010

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>