PostgreSQL LOWER Function

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

PostgreSQL LOWER() function

LOWER() function

The PostgreSQL lower function is used to convert a string from upper case to lower case.

Syntax :

lower(string)

Parameters :

Name Description
string A string whose characters are going to be converted to lowercase.

Example : PostgreSQL LOWER() function

The following PostgreSQL statement returns the given string after converting all of its characters in lowercase.

SELECT lower('W3RESOURCE') AS "Upper to Lower";

Output :

 Upper to Lower
----------------
 w3resource
(1 row)

Example of LOWER() on column of a table :

If we want to display the first name, last name, email and the lower of email of those employees who belong to the dept 20 from the employee table, the following SQL can be executed:

SELECT first_name,last_name,
email,LOWER(email)
FROM employees
WHERE department_id=20;

Output :

 first_name | last_name |  email   |  lower
------------+-----------+----------+----------
 Michael    | Hartstein | MHARTSTE | mhartste
 Pat        | Fay       | PFAY     | pfay
(2 rows)