Function Reference

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');
initcap
Hello Sql Academy

Apostrophe and hyphen split words

PostgreSQL 17.5
SELECT INITCAP('o''neil mcdonald-smith');
initcap
O'Neil Mcdonald-Smith

Product names from a table

PostgreSQL 17.5
SELECT good_name,
	INITCAP(good_name) AS title
FROM Goods;
good_nametitle
apartment feeApartment Fee
phone feePhone Fee
breadBread
milkMilk
red caviarRed Caviar
cinemaCinema
black caviarBlack Caviar
cough tabletsCough Tablets
potatoPotato
pineapplesPineapples

Details

Words are separated by any characters other than letters and digits.

See also