LOWER()
Converts all characters in a string to lowercase.
Description
LOWER converts every letter in a string to its lowercase form. It's
commonly used to normalize text before comparing it, since SQL string
comparisons are usually case-sensitive by default.
Syntax
LOWER(string)Parameters
| Name | Description | Optional |
|---|---|---|
| string | The text value or column to convert. Non-letter characters (numbers, punctuation) are left unchanged. | No |
Return Type
LOWER returns a VARCHAR (text) value.
Examples
Movies (Movies/Actors/Ratings)
Loading database engine...
Movies (Movies/Actors/Ratings)
Loading database engine...
Use LOWER for case-insensitive comparisons
If you're not sure whether a text column is stored consistently (some rows
'Action', others 'action'), comparing LOWER(genre) = 'action' is a
safer filter than genre = 'Action'.
Common Mistakes
- Assuming the underlying data changes.
LOWER(genre)only affects the query result; it does not update the value stored in themoviestable. - Forgetting it when comparing user input to stored text. A filter like
WHERE genre = 'action'will miss rows stored as'Action'unless both sides are lowercased withLOWER. - Using
LOWERon a non-text column. Applying it to a numeric or date column either errors or requires an explicitCASTfirst.
Related Functions
See also: UPPER, CONCAT, LENGTH.