Skip to main content
SQL • LESSON 139

REPLACE

How can we remove dashes from phone numbers?

Advanced3 Minutes1520 XP
🤔 THE QUESTION

How can we remove dashes from phone numbers?

💡 WHAT IS IT?

REPLACE(str, search, replacement) substitutes all occurrences of a substring with a target string.

🎯 WHAT IS IT USED FOR?

Phone number normalization, replacing special characters, scrubbing delimiters.

💻 EXAMPLE
SELECT
REPLACE(phone, '-', '') AS normalized_phone
FROM employees;

🎯 Mission Objectives

Practice typing production-grade SQL code for REPLACE.

  • REPLACE() function
  • Character scrubbing
  • Phone normalization
  • String sanitization