LOWER() in SQL
Converts all characters in a string to lowercase letters.
Syntax
Return type
LOWER() Function Example
What is LOWER() in SQL?
The LOWER()
function in SQL converts all characters in a given string to lowercase. It is useful for case-insensitive comparisons, normalizing text data, and ensuring consistency in databases where case sensitivity may impact query results. This function is supported across various database management systems, including MySQL, PostgreSQL, SQL Server, and SQLite. The LOWER()
function does not alter the original data but returns a new string with all letters in lowercase, making it an essential tool for handling user input, standardizing stored values, and improving search accuracy in SQL queries.
Parameters:
string: The input string or column to be converted to lowercase
Example Use Cases:
-- Standardize email addresses
-- Case-insensitive comparison
-- Uniform data storage
Notes:
Behavior: Converts all alphabetic characters to lowercase; numbers and special characters remain unchanged
Performance Considerations: Very efficient, minimal impact on database performance
Version Info: Core SQL function, supported in all major database systems
Error Handling:
Error: Generally handles NULL gracefully by returning NULL
Supported Databases:
DBMS
Function / Syntax
Example
Behavior with NULL
MySQL
LOWER()
LOWER('HELLO')
Returns NULL
PostgreSQL
LOWER()
LOWER('HELLO')
Returns NULL
SQL Server
LOWER()
LOWER('HELLO')
Returns NULL
SQLite
LOWER()
LOWER('HELLO')
Returns NULL
BigQuery
LOWER()
LOWER('HELLO')
Returns NULL
Snowflake
LOWER()
LOWER('HELLO')
Returns NULL
Athena
LOWER()
LOWER('HELLO')
Returns NULL