Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to transform to lowercase a value in SQLite?

In the SQLite database, I have stored all values in uppercase.

How can I select the specified value in the database using lower case?

like image 740
user533787 Avatar asked Apr 07 '11 09:04

user533787


People also ask

How do I convert a string to lowercase in SQL?

The LOWER() function converts a string to lower-case.

How do I make SQLite query case insensitive?

How do I make SQLite query case-insensitive? To be case insensitive on firstname , write this: select * from tbl where firstname='john' COLLATE NOCASE and lastname='doe' . It's specific to that one column, not the entire where clause.

Is SQLite like case sensitive?

Note that SQLite LIKE operator is case-insensitive. It means "A" LIKE "a" is true. However, for Unicode characters that are not in the ASCII ranges, the LIKE operator is case sensitive e.g., "Ä" LIKE "ä" is false.


1 Answers

SQLite has a LOWER function for this:

sqlite> SELECT LOWER("Hello, WORLD!");
hello, world!

The lower(X) function returns a copy of string X with all ASCII characters converted to lower case. The default built-in lower() function works for ASCII characters only. To do case conversions on non-ASCII characters, load the ICU extension.

like image 191
Mark Rushakoff Avatar answered Sep 18 '22 13:09

Mark Rushakoff