How SQLite Lower() Works

The SQLite lower() function allows you to convert a string to lowercase characters.

More precisely, it returns a copy of its argument, with all ASCII characters converted to lowercase.

Example

Here’s a basic example to demonstrate.

SELECT lower('BLACK Cat');

Result:

black cat

Database Example

Here’s an example of using the lower() function in a query against a database column.

SELECT 
  CatName,
  lower(CatName)
FROM Cats;

Result:

CatName     lower(CatName)
----------  --------------
Brush       brush         
Brash       brash         
Broosh      broosh        
100%Fluff   100%fluff     
100$Fluff   100$fluff     

Here, the left column contains the original value, and the right column contains those values converted to lowercase.

Number of Arguments

The lower() function requires one, and only one, argument.

If you provide no arguments, you’ll get an error.

SELECT lower();

Result:

Error: wrong number of arguments to function lower()

And if you provide too many arguments, you’ll also get an error.

SELECT lower('Black', 'Cat');

Result:

Error: wrong number of arguments to function lower()

Non-ASCII Characters

As mentioned, lower() only works on ASCII characters (the 26 letters used in the English language). SQLite only understands upper/lower case for ASCII characters by default.

You can load the SQLite ICU extension if you need to do case conversions on non-ASCII characters.

The ICU based functions provided by this extension provide case mapping, where defined, for the full range of unicode characters.