Replace the string of column in postgresql

In order to replace the string of column in postgresql we use REPLACE() function. REPLACE() function of column in postgresql replace the value of the column. Let’s see how to

  • Replace the string of column in postgresql.

Syntax of REPLACE():

REPLACE(source, old_text, new_text );

We will be using Zipcodes table.

Replace the column value in postgresql 1

 

Replace the string of column in Postgresql:

In order to replace the string of column in postgresql we use REPLACE() function.

select *,REPLACE(city,"a","A") as Replace_city FROM zipcodes

Replace function of city column replaces “a” with “A”. So the resultant dataframe will be

Replace the column value in postgresql 2