コンテンツにスキップ

文字列 str に含まれる文字列 from_str をすべて文字列 to_str に置き換えた結果を返します。

func.replace(<str>, <from_str>, <to_str>)
func.replace(<str>, <from_str>, <to_str>)
┌──────────────────────────────────────┐
│ func.replace('plaidCloud', 'p', 'P') │
├──────────────────────────────────────┤
│ PlaidCloud │
└──────────────────────────────────────┘
REPLACE(<str>, <from_str>, <to_str>)
引数 説明
<str> 文字列。
<from_str> 置換前の文字列。
<to_str> 置換後の文字列。

VARCHAR

SELECT REPLACE('www.mysql.com', 'w', 'Ww');
┌─────────────────────────────────────┐
│ REPLACE('www.mysql.com', 'w', 'Ww') │
├─────────────────────────────────────┤
│ WwWwWw.mysql.com │
└─────────────────────────────────────┘