Convert column to Title case or proper case in Postgresql (INITCAP)

In order to convert the column to Title case or proper case in postgresql we use INITCAP() function.  INITCAP function in postgresql converts string column to proper case. Let’s see how to

  • Convert column to Title case or proper case in postgresql

Syntax of INITCAP():

INITCAP()

We will be using states table.

convert column to propercase in postgresql 1

 

Convert column to title case or proper case in postgresql:

INITCAP() function converts the column to proper case in postgresql

select *, INITCAP(state_name) as proper_state from states

We have converted the state_name column to proper case. So the resultant table will be

convert column to propercase in postgresql 2

 

                                                                                                         

Author

  • Sridhar Venkatachalam

    With close to 10 years on Experience in data science and machine learning Have extensively worked on programming languages like R, Python (Pandas), SAS, Pyspark.