totn PostgreSQL Functions

PostgreSQL: initcap Function

This PostgreSQL tutorial explains how to use the PostgreSQL initcap function with syntax and examples.

Description

The PostgreSQL initcap function converts the first letter of each word to uppercase and all other letters are converted to lowercase.

Syntax

The syntax for the initcap function in PostgreSQL is:

initcap( string )

Parameters or Arguments

string
The string to convert.

Note

  • If there are characters in the string that are not letters, they are unaffected by the initcap function.
  • See also the upper and lower functions.

Applies To

The initcap function can be used in the following versions of PostgreSQL:

  • PostgreSQL 9.4, PostgreSQL 9.3, PostgreSQL 9.2, PostgreSQL 9.1, PostgreSQL 9.0, PostgreSQL 8.4

Example

Let's look at some PostgreSQL initcap function examples and explore how to use the initcap function in PostgreSQL.

For example:

postgres=# SELECT initcap('This is an example by techonthenet.com.');
                 initcap
-----------------------------------------
 This Is An Example By Techonthenet.Com.
(1 row)

postgres=# SELECT initcap('Learn PostgreSQL with Tech on the Net!');
                initcap
----------------------------------------
 Learn Postgresql With Tech On The Net!
(1 row)