Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

Char_Length()Function AND ASCII() Function in MariaDB

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

1. CHAR_LENGTH() Function :
In MariaDB, the CHAR_LENGTH function used for calculation of the total character length of a string. In this function, a string will be passed as a parameter and it will return the length of that string.it will a numeric type.

Syntax :

CHAR_LENGTH(string)

Parameter : Required.
string : It will return the string length.

Example-1 :

SELECT CHAR_LENGTH('GEEKSFORGEEKS');

Output :

13



Example-2 :

SELECT CHAR_LENGTH(' ');

Output :

1



Example-3 :

SELECT CHAR_LENGTH('');

Output :

0



Example-4 :

SELECT CHAR_LENGTH(NULL);

Output :

NULL


2. ASCII() Function :
In MariaDB, the ASCII function is used for finding the ASCII value of the leftmost character in this string. In this function, a string will be passed as a parameter and it will return the ASCII value of the left-most character.

Syntax :

ASCII(single_character)

Parameter : Required.
single_character : If more than one character will be pass then it will ignore all characters except the first character.

Example-1 :

SELECT ASCII('GeeksForGeeks');

Output :

107



Example-2 :

SELECT ASCII('G');

Output :

107



Example-3 :

SELECT ASCII('g');

Output :

147



Example-4 :

SELECT ASCII('7');

Output :

55
My Personal Notes arrow_drop_up
Last Updated : 28 Sep, 2020
Like Article
Save Article
Similar Reads