In SQLite we can use the lower()
function to convert uppercase characters to lowercase.
Example
SELECT lower('COVERT OPERATION');
Result:
covert operation
We can see that all uppercase characters were converted to their lowercase equivalent.
Any existing lowercase characters will remain lowercase:
SELECT lower('Covert Operation');
Result:
covert operation
A Database Example
Here’s an example that uses data from a database:
SELECT
Name,
lower(Name)
FROM Playlist;
Result:
+----------------------------+----------------------------+ | Name | lower(Name) | +----------------------------+----------------------------+ | Music | music | | Movies | movies | | TV Shows | tv shows | | Audiobooks | audiobooks | | 90’s Music | 90’s music | | Audiobooks | audiobooks | | Movies | movies | | Music | music | | Music Videos | music videos | | TV Shows | tv shows | | Brazilian Music | brazilian music | | Classical | classical | | Classical 101 - Deep Cuts | classical 101 - deep cuts | | Classical 101 - Next Steps | classical 101 - next steps | | Classical 101 - The Basics | classical 101 - the basics | | Grunge | grunge | | Heavy Metal Classic | heavy metal classic | | On-The-Go 1 | on-the-go 1 | +----------------------------+----------------------------+
In this case, I converted all data in the Name
column to its lowercase equivalent.
We can alternatively use the upper()
function if we need to convert the other way around (i.e. from lowercase to uppercase).