SQL LOWER Function
Quick summary: The SQL LOWER() function converts a string to lowercase.
SQL LOWER Syntax
LOWER(string)
SQL
SQL LOWER Basic examples
SELECT LOWER('Hello');
SQL
Output:
hello
Converts text to lowercase.
SQL LOWER Real-world usage
SELECT * FROM users WHERE LOWER(email) = 'test@example.com';
SQL
Output:
Matching user
Implements case-insensitive matching.
SQL LOWER Edge cases
SELECT LOWER(NULL);
SQL
Output:
NULL
Returns NULL when input is NULL.
SQL LOWER Common mistakes
Lowercasing indexed columns in WHERE
Functions prevent index usage.
Incorrect
WHERE LOWER(email) = 'a@test.com'
Correct
WHERE email = 'a@test.com' COLLATE utf8mb4_general_ci
Use case-insensitive collation instead.
SQL LOWER Frequently Asked Questions
What does LOWER() do in SQL?
Converts a string to lowercase.
Use case of LOWER()?
Case-insensitive comparisons.
Syntax?
LOWER(string).
Common mistake?
Expecting index usage.
Return type?
String.
Handles NULL?
Returns NULL.
Performance?
Can disable indexes.
Alternative?
ILIKE (PostgreSQL).
Used in WHERE?
Yes.
Supports multibyte?
Depends on DB.
Used in search?
Yes.
Best practice?
Use indexed normalized columns.