콘텐츠로 이동

문자열 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 │
└─────────────────────────────────────┘