
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Get Number Code of a Specific Character in MySQL
String function ASCII() in MySQL returns the ASCII number code of the specific character.
Syntax
ASCII(str)
Here, str, the argument of ASCII() function, is the string whose ASCII value of the first character to be retrieved.
It is pertinent to mention here that it will return the number code the left the most character i.e. first character of the string given as argument.
Example
mysql> SELECT ASCII('A') as 'ASCII VALUE OF CAPITAL A'; +--------------------------+ | ASCII VALUE OF CAPITAL A | +--------------------------+ | 65 | +--------------------------+ 1 row in set (0.00 sec) mysql> SELECT ASCII('a') as 'ASCII VALUE OF CAPITAL a'; +--------------------------+ | ASCII VALUE OF CAPITAL a | +--------------------------+ | 97 | +--------------------------+ 1 row in set (0.00 sec) mysql> SELECT ASCII('Abhay') as 'Left_most Character ASCII value'; +---------------------------------+ | Left_most Character ASCII value | +---------------------------------+ | 65 | +---------------------------------+ 1 row in set (0.00 sec)
Advertisements