PostgreSQL LOWER() Function
The PostgreSQL LOWER() function converts all characters of the given string to lowercase. Any symbol, space, or number in the string is ignored while applying this function. Only alphabet are converted.
Syntax
LOWER(string)
Parameters
string |
Required. Specify the string to convert to lowercase. |
Return Value
Returns the string with all characters of the specified string to lowercase.
Example 1:
The example below shows the usage of LOWER() function.
SELECT LOWER('Learning SQL is FUN!'); Result: 'learning sql is fun!' SELECT LOWER(' SQL Tutorial '); Result: ' sql tutorial '
Example 2:
Consider a database table called Employee with the following records:
EmpID | Name | City | Age | Salary |
---|---|---|---|---|
1 | John | London | 25 | 3000 |
2 | Marry | New York | 24 | 2750 |
3 | Jo | Paris | 27 | 2800 |
4 | Kim | Amsterdam | 30 | 3100 |
5 | Ramesh | New Delhi | 28 | 3000 |
6 | Huang | Beijing | 28 | 2800 |
The query given below is used to convert of column City to lowercase.
SELECT *, LOWER(City) AS City_Lowercase FROM Employee;
The query will produce the following result:
EmpID | Name | City | Age | City_Lowercase |
---|---|---|---|---|
1 | John | London | 25 | london |
2 | Marry | New York | 24 | new york |
3 | Jo | Paris | 27 | paris |
4 | Kim | Amsterdam | 30 | amsterdam |
5 | Ramesh | New Delhi | 28 | new delhi |
6 | Huang | Beijing | 28 | beijing |
❮ PostgreSQL Functions