This SQLite post explains how to use the SQLite replace function with syntax and examples.
The SQLite replace function replaces all occurrences of a specified string.
The syntax for the replace function in SQLite is:
replace( string, from_substring, to_substring )
The source string.
The substring to find. All occurrences of from_substring found within string are replaced with to_substring.
The replacement substring. All occurrences of from_substring found within string are replaced with to_substring.
The replace function can be used in the following versions of SQLite:
Let's look at some SQLite replace function examples and explore how to use the replace function in SQLite.
For example:
sqlite> SELECT replace('AODBA.com', 'AODBA', 'checkyoursite');
Output: 'checkyoursite.com'
sqlite> SELECT replace('abc abc', 'a', 'B');
Output: 'Bbc Bbc'
sqlite> SELECT replace('abc abc', 'A', 'B');
Output: 'abc abc'
sqlite> SELECT replace('789 789', 9, 3);
Output: '783 783'