SQL
[MySQL] REPLACE 함수
노력의천재
2021. 8. 24. 20:22
https://www.hackerrank.com/challenges/the-blunder/problem
The Blunder | HackerRank
Query the amount of error in Sam's result, rounded up to the next integer.
www.hackerrank.com
http://tcpschool.com/mysql/mysql_builtInFunction_string
코딩교육 티씨피스쿨
4차산업혁명, 코딩교육, 소프트웨어교육, 코딩기초, SW코딩, 기초코딩부터 자바 파이썬 등
tcpschool.com
REPLACE
전달받은 문자열에서 특정 문자열을 찾은 후에, 찾은 문자열을 대체 문자열로 교체한다.
이때 문자열 뿐만 아니라 정수를 전달받아도 해당 함수를 사용할 수 있는 것을 확인했다.
-- Salary는 Integer인데 replace 함수를 사용할 수 있었다.
select ceil(avg(Salary) - avg(replace(Salary, '0', '')))
from EMPLOYEES;