- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can we produce a string, other than default binary string, in a given character set by MySQL CHAR() function?
We can use the keyword USING to produce a string, other than default binary string, in a given character set. Following result set will demonstrate it −
mysql> Select CHARSET(CHAR(85 USING utf8)); +------------------------------+ | CHARSET(CHAR(85 USING utf8)) | +------------------------------+ | utf8 | +------------------------------+ 1 row in set (0.00 sec)
The above result set shows that the returned binary string is utf8 because we write utf8 after the keyword USING.
mysql> Select CHARSET(CHAR(85 USING latin1)); +--------------------------------+ | CHARSET(CHAR(85 USING latin1)) | +--------------------------------+ | latin1 | +--------------------------------+ 1 row in set (0.00 sec)
The above result set shows that the returned binary string is latin1 because we write latin1 after the keyword USING.
Advertisements