☰ See All Chapters |
MySQL ASCII Function
MySQL ASCII function returns ASCII value of first character from a string.
MySQL ASCII Function Syntax
ASCII(arg) |
arg is the argument for which you want get the ASCII value for first character. This can be an expression or a direct value or a value from a column of any type.
MySQL ASCII Function Example
Creating table for demonstrating ASCII Function
CREATE TABLE NAME ( FNAME VARCHAR(10 ) NOT NULL, LNAME VARCHAR(10 ) ); Insert into NAME (FNAME, LNAME) Values ('ADI', 'TEMP'); Insert into NAME (FNAME, LNAME) Values ('NAVEEN', 'SHETTY'); Insert into NAME (FNAME, LNAME) Values ('ARJUN', 'SHETTY'); Insert into NAME (FNAME, LNAME) Values ('HARISH', 'GOWDA'); Insert into NAME (FNAME, LNAME) Values ('HARI', 'PRASAD'); Insert into NAME (FNAME, LNAME) Values ('ARJUN', 'SHETTY'); Insert into NAME (FNAME, LNAME) Values ('KIRAN', 'KUMAR'); COMMIT; |
Example 1
SELECT FNAME,LNAME,ASCII(FNAME) FROM NAME |
Example 2
SELECT FNAME,LNAME,ASCII('M') FROM NAME |
All Chapters