totn MariaDB Functions

MariaDB: ASCII Function

This MariaDB tutorial explains how to use the MariaDB ASCII function with syntax and examples.

Description

The MariaDB ASCII function returns the numeric value of the left-most character of a string.

Syntax

The syntax for the ASCII function in MariaDB is:

ASCII( single_character )

Parameters or Arguments

single_character
The specified character to retrieve the NUMBER code for. If more than one character is entered, the ASCII function will return the value for the first character and ignore all of the characters after the first.

Applies To

The ASCII function can be used in the following versions of MariaDB:

  • MariaDB 10

Example

Let's look at some MariaDB ASCII function examples and explore how to use the ASCII function in MariaDB.

For example:

SELECT ASCII('c');
Result: 99

SELECT ASCII('C');
Result: 67

SELECT ASCII('CheckYourMath.com');
Result: 67

SELECT ASCII('3');
Result: 51

View a listing of the ASCII values.