UPDATESQL

Unit 3, lesson 5 · REPLACE

Fixing text with REPLACE

Dots to dashes in phone numbers

REPLACE(text, find, replace_with) swaps every occurrence of one piece of text for another. REPLACE('8-in-1', '-', ' ') is '8 in 1'. Replace with '' (nothing) to remove characters altogether. Values that do not contain the text come through unchanged.

Example
SELECT name,
       REPLACE(name, '-', ' ') AS display_name
FROM products;

Your task

Some people typed their phone number with dots, like '303.555.0142'. List each sign-up's id and the phone number with every dot changed to a dash, as phone.

Tables you will use: signups

Try it in your browserFree, no sign-up. Your query is checked as you go.