Replace String in SQL

Level 132 keystrokes

REPLACE function substitutes occurrences of a substring with another.

SQL code

-- REPLACE(string, search, replacement) replaces every occurrence of search
-- Each 'b' in 'abc' becomes 'x', so this returns 'axc'
1SELECT REPLACE('abc', 'b', 'x');

Output

+---------------------------+
| REPLACE('abc', 'b', 'x')  |
+---------------------------+
| axc                       |
+---------------------------+
1 row in set
Practice typing this code

Practice typing this code. Results are not recorded in the rankings.

Symbols in this code

The symbols you type in this SQL code and how often they appear.

  • '× 6
  • ,× 2
  • ;× 1
  • (× 1
  • )× 1

More SQL examples at level 1

← SQL typing practice