Database Reference
In-Depth Information
mysql> SELECT 'Install MySQL in C:\\mysql on Windows';
+--------------------------------------+
| Install MySQL in C:\mysql on Windows |
+--------------------------------------+
| Install MySQL in C:\mysql on Windows |
+--------------------------------------+
Backslash causes a temporary escape from normal string processing rules, so se‐
quences such as \' , \" , and \\ are called escape sequences. Others recognized by
MySQL are \b (backspace), \n (newline, also called linefeed), \r (carriage return),
\t (tab), and \0 (ASCII NUL).
• Write the string as a hex value:
mysql> SELECT 0x49276D2061736C656570;
+------------------------+
| 0x49276D2061736C656570 |
+------------------------+
| I'm asleep |
+------------------------+
See Also
If you execute SQL statements from within a program, you can refer to strings or binary
values symbolically and let your programming interface take care of quoting: use the
placeholder mechanism provided by the language's database-access API (see
Recipe 2.5 ). Alternatively, load binary values such as images from files using the
LOAD_FILE() function (see Recipe 19.6 ).
5.5. Checking or Changing a String's Character Set or
Collation
Problem
You want to know the character set or collation of a string, or change a string to some
other character set or collation.
Solution
To check a string's character set or collation, use the CHARSET() or COLLATION() func‐
tion. To change its character set, use the CONVERT() function. To change its collation,
use the COLLATE operator.
Search WWH ::




Custom Search