LOWER function in SQL

The LOWER function in SQL is used to convert a string to lowercase. This function is useful when we need to perform case-insensitive comparisons or when we want to standardize text data.

SQL Syntax

LOWER(string)

Example: Let's assume we have a table employees with the following data:

employee_idfirst_namelast_namedepartment
1JohnDoeSales
2JaneSmithMarketing
3MichaelO'ConnorHR
4SarahO'BrienIT
5LauraWilsonSales

To convert the first_name column to lowercase:

SQL

SELECT employee_id, LOWER(first_name) AS first_name_lower, last_name, department
FROM employees;

The result of the above query is shown below:

employee_idfirst_name_lowerlast_namedepartment
1johnDoeSales
2janeSmithMarketing
3michaelO'ConnorHR
4sarahO'BrienIT
5lauraWilsonSales