Monday 22 May 2017

Differentiate between CHAR_LENGTH and LENGTH ?

Difference between CHAR_LENGTH and LENGTH ?

CHAR_LENGTH, as the name suggests, returns the number of characters / character count. The LENGTH returns the number of bytes / bytes count. While counting the Latin characters, both lengths are the same,but at time of counting Unicode and other encodings, the lengths are different.

Mysql char_length

Usage:

 SELECT CHAR_LENGTH('test string');  
Output: 11


No comments:

Post a Comment

Advertisement

Advertisement