REPLACE
Returns a string formed by substituting a portion of a string for every occurrence of another string.
See also:
[SELECT
]
Syntax
SELECT REPLACE(character_expression, pattern, replacement) FROM <multipartIdentifier>;
Arguments
character_expression
A literal string or string column that you want to perform the replacement on.
pattern
The substring to be found in the original string.
If pattern is an empty string or is not found in character_expression, then character_expression will be returned unchanged.
replacement
The replacement string.
If replacement is not initially a string, it is cast to a UTF-8 string prior to processing.
The
BINARY
collating sequence is used for comparisons.
Return Value(s)
Returns a string.
Examples
Replace a string pattern in a column
SELECT replace(name, 'prd', 'production') AS replacement_string
FROM google.compute.instances
WHERE project = 'stackql-demo'
AND zone = 'australia-southeast1-a';
For more information, see https://www.sqlite.org/lang_corefunc.html#replace