Tuesday 2 August 2016

CHAR_LENGTH: Return number of characters in string




CHAR_LENGTH function return number of characters in a string, where as LENGTH function return amount of space occupied by string in bytes.

mysql> SELECT CHAR_LENGTH("你好");
+-----------------------+
| CHAR_LENGTH("你好")   |
+-----------------------+
|                     2 |
+-----------------------+
1 row in set (0.00 sec)


mysql> SELECT LENGTH("你好");
+------------------+
| LENGTH("你好")   |
+------------------+
|                6 |
+------------------+
1 row in set (0.00 sec)



Previous                                                 Next                                                 Home

No comments:

Post a Comment