INITCAP
Converts the first letter of each word to upper case and the rest to lower case.
PostgreSQL 17.5
INITCAP(string)Parameters
- stringtext
- Source string
Return value
A string where each word starts with a capital letter and the other letters are lowercase
Examples
Each word capitalized
PostgreSQL 17.5
SELECT INITCAP('hello sql academy');Apostrophe and hyphen split words
PostgreSQL 17.5
SELECT INITCAP('o''neil mcdonald-smith');Product names from a table
PostgreSQL 17.5
SELECT good_name,
INITCAP(good_name) AS title
FROM Goods;Details
Words are separated by any characters other than letters and digits.