LCASE Function - SQL


Overview


The LCASE function in SQL converts all characters in a string to lowercase. It is useful for standardizing text to lowercase.

Example:

SELECT LCASE('Hello, WORLD')

Syntax:

SELECT LCASE(string_expression)

string_expression is the string you want to convert to lowercase.

Sample Data:

department_id first_name
3 Frank
2 Jane
3 Ashley
NULL Glenn
2 Kelly
1 Richard
1 George
5 Kyle
2 James
1 Gustavo

Example: Hard-coded value


In this example, we are returning the string ‘Hello, WORLD’ in all lowercase, the final output is ‘hello, world.’


Example: Query without the WHERE Statement


In this example, we are returning all of the rows in the first_name column in all lowercase.


Example: Query with the WHERE Statement


In this example, we are returning all of the rows in the first_name column in all lowercase where the department_id equals 1.