Skip to content
Advertisement

SQL Data cleaning

I have a data set where I am trying to clean data. I want to remove the ** from email-address and phone_number and have just numbers in the phone_number column. how can i do it.

enter image description here

Advertisement

Answer

Here is one option using string functions:

update mytable 
set email        = replace(email, '**', ''), 
    phone_number = regexp_replace(phone_number, '\D', '')

This removes '**' from email, and all non-digit characters from phone_number.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement