📣
TiDB Cloud Premium is now in public preview. Unlimited growth, instant elasticity, advanced security for enterprise workloads. Try it out →

TRANSLATE



Transforms a given string by replacing specific characters with corresponding replacements, as defined by the provided mapping.

Syntax

TRANSLATE('<inputString>', '<charactersToReplace>', '<replacementCharacters>')
ParameterDescription
<inputString>The input string to be transformed.
<charactersToReplace>The string containing characters to be replaced in the input string.
<replacementCharacters>The string containing replacement characters corresponding to those in <charactersToReplace>.

Examples

-- Replace 'd' with '$' in 'datalake' SELECT TRANSLATE('datalake', 'd', '$'); --- $atalake -- Replace 'd' with 'D' in 'datalake' SELECT TRANSLATE('datalake', 'd', 'D'); --- Datalake -- Replace 'd' with 'D' and 'e' with 'E' in 'datalake' SELECT TRANSLATE('datalake', 'de', 'DE'); --- DatalakE -- Remove 'd' from 'datalake' SELECT TRANSLATE('datalake', 'd', ''); --- atalake

Was this page helpful?