SQLite Tutorial SQLite Advanced SQLite Database SQLite References

SQLite UNICODE() Function



The SQLite UNICODE() function returns the numeric unicode code point corresponding to the first character of the specified string. If the passed argument is not a string then the result is undefined.

Syntax

UNICODE(character)

Parameters

character Required. Specify the character to return the unicode code point for. If more than one character is entered, the function will only return the value for the first character.

Return Value

Returns the unicode code point of a character.

Example 1:

The example below shows the usage of UNICODE() function.

SELECT UNICODE('A');
Result: 65

SELECT UNICODE(1);
Result: 49

SELECT UNICODE('AlphaCodingSkills.com');
Result: 65

SELECT UNICODE(123);
Result: 49

SELECT UNICODE('@gmail.com');
Result: 64

Example 2:

Consider a database table called Employee with the following records:

EmpIDNameCity
1JohnLondon
2MarryNew York
3JoParis
4KimAmsterdam
5RameshNew Delhi
6HuangBeijing

In the query below, the UNICODE() function is used to get the unicode code point of the first character of Name column value of Employee table.

SELECT *, UNICODE(Name) AS UNICODE_Val FROM Employee;

This will produce the result as shown below:

EmpIDNameCityUNICODE_Val
1JohnLondon74
2MarryNew York77
3JoParis74
4KimAmsterdam75
5RameshNew Delhi82
6HuangBeijing72

❮ SQLite Functions