MySQL CHAR() function
MySQL CHAR() returns the character value of the given integer value according to the ASCII table. It ignores the NULL value.
This function is useful in -
- It allows you to generate a character based on its ASCII value. For example, CHAR(67) will return the uppercase letter 'C', as 67 is the ASCII value for 'C'.
- CHAR() can be used to transform numeric or ASCII-based data into character representations.
- The CHAR() function can be used in conditional expressions or in CASE statements to conditionally return different characters based on certain conditions or criteria.
CHAR (N…[USING characterset name])
|N||Integers whose character values (according to the ASCII table) are to be retrieved.|
MySQL Version: 8.0
Example: MySQL CHAR() function
The following MySQL statement returns character values (according to the ASCII table) of the integers 67, 72, 65 and 82.
mysql> SELECT CHAR(67,72,65,82); +-------------------+ | CHAR(67,72,65,82) | +-------------------+ | CHAR | +-------------------+ 1 row in set (0.02 sec)
- Weekly Trends
- Python Interview Questions and Answers: Comprehensive Guide
- Scala Exercises, Practice, Solution
- Kotlin Exercises practice with solution
- MongoDB Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - JOINS
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join
We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook