Strings

TRANSLATE

Replaces individual characters with others — each with its own, in a single pass.

Syntax

TRANSLATE(<text>, <characters>, <replacements>)

Takes the characters from the second argument and replaces each with the character in the same position in the third: the first with the first, the second with the second. Characters that have no pair are simply deleted. Handy for removing stray symbols or replacing several characters at once.

Data for the examples

employees

namedepartmentsalarybonusphone
Emmabackend1200300+44 7700 900123
Liambackend1000NULLNULL
Oliviafrontend1350150+44 7700 900456
Noahfrontend950NULL+44 7700 900789
Sophiadesign1200200NULL

These tables already exist in the sandbox — the examples below use them. Want to try this in your own database? Copy the SQL.

Character for character
SELECT TRANSLATE('2026/09/13', '/', '-') AS dashed;
dashed
2026-09-13
Remove brackets and spaces
SELECT TRANSLATE('+44 (0) 7700', '() ', '') AS cleaned;
cleaned
+4407700

The third argument has no pairs at all, so the brackets and spaces simply disappear.

Phone numbers without the plus and spaces
SELECT name, phone,
TRANSLATE(phone, '+ ', '') AS digits
FROM employees;
namephonedigits
Emma+44 7700 900123447700900123
LiamNULLNULL
Olivia+44 7700 900456447700900456
Noah+44 7700 900789447700900789
SophiaNULLNULL

Watch out

It replaces characters, not words: TRANSLATE('cat', 'cat', 'dog') gives dog, but TRANSLATE('act', 'cat', 'dog') gives odg — each letter separately.

Characters with no pair in the third argument are deleted: TRANSLATE('a-b-c', '-', '') removes every hyphen.

To replace whole words, use REPLACE; for patterns — REGEXP_REPLACE.

Related functions