+----------------+----------------+ | 0100 | 0100 | +----------------+----------------+ mysql> SELECT HEX(CHAR(1,0,0)), HEX(CHAR(256*256)); +------------------+--------------------+ | HEX(CHAR(1,0,0)) | HEX(CHAR(256*256)) | +------------------+--------------------+ | 010000 | 010000 | +------------------+--------------------+ 

By default, CHAR()  returns a binary string. To produce a string in a given character set, use the optional USING  clause: 

mysql> SELECT CHARSET(CHAR(X’65’)), CHARSET(CHAR(X’65’ USING utf8)); +----------------------+---------------------------------+ | CHARSET(CHAR(X’65’)) | CHARSET(CHAR(X’65’ USING utf8)) | +----------------------+---------------------------------+ | binary | utf8 | +----------------------+---------------------------------+ 

If USING  is given and the result string is illegal for the given character set, a warning is issued. Also, if strict SQL mode is enabled, the result from CHAR()  becomes NULL . 

If CHAR()  is invoked from within the mysql  client, binary strings display using hexadecimal notation, depending on the value of the --binary-as-hex . For more information about that option, see Section 4.5.1, “mysql — The MySQL Command-Line Client” . 

• CHAR_LENGTH( str ) 

Returns the length of the string str , measured in characters. A multibyte character counts as a single character. This means that for a string containing five 2-byte characters, LENGTH()  returns 10 , whereas CHAR_LENGTH()  returns 5 . 

• CHARACTER_LENGTH( str ) 

CHARACTER_LENGTH()  is a synonym for CHAR_LENGTH() . 

• CONCAT( str1 , str2 ,...) 

Returns the string that results from concatenating the arguments. May have one or more arguments. If all arguments are nonbinary strings, the result is a nonbinary string. If the arguments include any binary strings, the result is a binary string. A numeric argument is converted to its equivalent nonbinary string form. 

CONCAT()  returns NULL  if any argument is NULL . 

mysql> SELECT CONCAT(’My’, ’S’, ’QL’); -> ’MySQL’ mysql> SELECT CONCAT(’My’, NULL, ’QL’); -> NULL mysql> SELECT CONCAT(14.3); -> ’14.3’ 

For quoted strings, concatenation can be performed by placing the strings next to each other: 

mysql> SELECT ’My’ ’S’ ’QL’; -> ’MySQL’ 

If CONCAT()  is invoked from within the mysql  client, binary string results display using hexadecimal notation, depending on the value of the --binary-as-hex . For more information about that option, see Section 4.5.1, “mysql — The MySQL Command-Line Client” . 

