Remove all the spaces of the column in Postgresql

To remove all the space of the column we will be using replace function, REPLACE() function in postgresql removes all the spaces of the column. Let see how to

  • Remove all the spaces of the column in Postgresql

We will be using states table.

Remove all the spaces of the column in Postgresql 1

 

 

Remove all the spaces of the column in Postgresql

In order to remove all the column in postgresql we use replace function as shown below.

SELECT *,REPLACE(state_name,' ','') as state_name_B from states

So the resultant table with all the spaces removed will be

Remove all the spaces of the column in Postgresql 2