To Convert column to title case in PostgreSQL we will be using INITCAP() function. It’s a built-in string function which converts a string to title case or proper case. INITCAP() function capitalizes the first letter of each word in a string and converts the rest of the letters to lowercase.
- Convert string to title case using INITCAP() function
- Convert column to title case in the PostgreSQL table using INITCAP () function
String to title case using INITCAP () Function:
The INITCAP() function in PostgreSQL converts all characters in a string to Title case or proper case.
Example:
SELECT INITCAP('address review')
OR
SELECT INITCAP('ADDRESS REVIEW')
Output:
Convert column to title case or proper case in the PostgreSQL table using INITCAP() function:
INITCAP() function capitalizes the first letter of each word in a string and converts the rest of the letters to lowercase. We will be using the INITCAP() function with select statement to convert the column to proper case
We will be using Employee1 table.
SELECT *, INITCAP(full_name) AS full_name_Titlecase FROM employee1;
In the above example we are converting column “full_name” into proper case or title case with the help of INITCAP() function.
Output: