SQLite3で文字列を指定した文字列で置換する方法
環境
Windows 10 Home 64bit
SQLite 3.39.2
構文
REPLACE( 文字列, 置換される文字列, 置換する文字列 )
REPLACE関数を使用して文字列を指定した文字列で置換します。
SQL構文
SELECT
REPLACE('study skill', 's', 'T'),
REPLACE('study skill', 'll', 'MM'),
REPLACE('study skill', 'tu', 'SN')
SELECT
REPLACE('study skill', 's', 'T'),
REPLACE('study skill', 'll', 'MM'),
REPLACE('study skill', 'tu', 'SN')
SELECT REPLACE('study skill', 's', 'T'), REPLACE('study skill', 'll', 'MM'), REPLACE('study skill', 'tu', 'SN')
操作例
sqlite> SELECT
...> REPLACE('study skill', 's', 'T'),
...> REPLACE('study skill', 'll', 'MM'),
...> REPLACE('study skill', 'tu', 'SN');
sqlite> SELECT
...> REPLACE('study skill', 's', 'T'),
...> REPLACE('study skill', 'll', 'MM'),
...> REPLACE('study skill', 'tu', 'SN');
sqlite> SELECT ...> REPLACE('study skill', 's', 'T'), ...> REPLACE('study skill', 'll', 'MM'), ...> REPLACE('study skill', 'tu', 'SN');
実行結果
Ttudy Tkill|study skiMM|sSNdy skill
Ttudy Tkill|study skiMM|sSNdy skill
Ttudy Tkill|study skiMM|sSNdy skill