LOWER() in SQL

Converts all characters in a string to lowercase letters.

Syntax

LOWER(string)
Return type
VARCHAR (or equivalent string type in the respective DBMS)

LOWER() Function Example

SELECT LOWER('HELLO World');
-- Output: 'hello world'

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

SELECT LOWER(email) AS normalized_email FROM users;
-- Output:
email                    normalized_email
----------------------  ----------------------
JOHN.DOE@GMAIL.COM      john.doe@gmail.com
Mary.Smith@YAHOO.COM    mary.smith@yahoo.com
BOB.WILSON@GMAIL.COM    bob.wilson@gmail.com
Sarah.Lee@COMPANY.COM   sarah.lee@company.com
MIKE.BROWN@YAHOO.COM    mike.brown@yahoo.com

-- Case-insensitive comparison

SELECT * FROM customers WHERE LOWER(name) = LOWER('JOHN DOE');
-- Output:
id    name         matches
----  -----------  --------
1     John Doe     ✓
2     JOHN DOE     
3     john doe     
4     John DOE     
5     JoHn DoE     

-- Uniform data storage

SELECT product_id, LOWER(description) AS normalized_description 
FROM products;
-- Output:
product_id    description         normalized_description
----------    -----------------   ---------------------
P001          LAPTOP COMPUTER    laptop computer
P002          WIRELESS MOUSE     wireless mouse
P003          USB CABLE          usb cable
P004          BLUETOOTH SPEAKER  bluetooth speaker
P005          GAMING KEYBOARD    gaming keyboard

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

Related Functions:

One place for all your queries,
directly on your SQL editor