string
LOWER
Converts a string to lowercase using the database's active collation/locale. Universally supported and safe for normalizing case-insensitive lookups.
LOWER(string) Parameters / Modifiers
| Parameter | Purpose |
|---|---|
| COLLATE ... | Force a specific locale for casing rules |
| CITEXT | Postgres: case-insensitive text type that avoids LOWER() in queries |
| LCASE | MySQL alias of LOWER |
Examples
SELECT LOWER('HELLO World'); Returns 'hello world'
SELECT * FROM users WHERE LOWER(email) = LOWER($1); Case-insensitive email lookup
CREATE INDEX ix_email_lower ON users (LOWER(email)); Postgres functional index that lets LOWER() lookups use an index
SELECT LOWER('ISTANBUL' COLLATE "tr_TR"); Postgres locale-aware casing (dotless i)
Dialect notes / Gotcha
Locale matters for Turkish 'I'/'İ' and German 'ß'. Without a functional index, LOWER(col) = ... disables the index on col in most engines.
Related functions
UPPER
Converts a string to uppercase using the current collation/locale. The mirror of LOWER, and equally universal across dialects.
TRIM
Removes matching characters from the start, end, or both sides of a string. Defaults to stripping spaces when no character set is supplied.
REPLACE
Replaces every occurrence of from_str inside source with to_str. Case-sensitive in Postgres and SQLite; MySQL follows the column's collation.
CONCAT
Joins two or more strings end-to-end and returns a single string. CONCAT is portable across MySQL, Postgres 9.1+, and SQLite 3.44+; the standard || operator works in Postgres and SQLite but not MySQL unless PIPES_AS_CONCAT is set.
LENGTH / CHAR_LENGTH
Returns the number of characters in a string (CHAR_LENGTH) or the number of bytes (LENGTH in MySQL). Postgres and SQLite LENGTH return character count for text, matching CHAR_LENGTH.
← All SQL functions · SQL cheat sheet · Window functions · PostgreSQL cheat sheet