- ABS (절대값) :
-
SELECT ABS(123) FROM DUAL -- 123 SELECT ABS(-10) FROM DUAL -- 10
-
- ROUND (반올림)
-
SELECT ROUND(1234.56789) FROM DUAL -- 1235 SELECT ROUND(1234.56789 ,1) FROM DUAL -- 1234.6 SELECT ROUND(1234.56789 ,4) FROM DUAL -- 1234.5679 SELECT ROUND(1234.56789 ,-1) FROM DUAL -- 1230 SELECT ROUND(1234.56789 ,-2) FROM DUAL -- 1200
-
- CEILING (올림)
-
SELECT CEILING(12.34) FROM DUAL -- 13 SELECT CEILING(12.99 ,1) FROM DUAL -- 13 SELECT CEILING(56.0) FROM DUAL -- 56 SELECT CEILING(19.1) FROM DUAL -- 20 SELECT CEILING(-19.1) FROM DUAL -- -19
-
- FLOOR (내림)
-
SELECT FLOOR(12.34) FROM DUAL -- 12 SELECT FLOOR(19.0) FROM DUAL -- 19 SELECT FLOOR(-19.1) FROM DUAL -- -20
-
- TRUNCATE (소수점 버림)
-
SELECT TRUNCATE(1234.56789 ,1) FROM DUAL; -- 1234.5 SELECT TRUNCATE(1234.56789 ,4) FROM DUAL; -- 1234.5678 SELECT TRUNCATE(1234.56789 ,-1) FROM DUAL; -- 1230 SELECT TRUNCATE(1234.56789 ,-2) FROM DUAL; -- 1200
-
Ref.
'개발 한 스푼 > MySQL' 카테고리의 다른 글
GROUP BY 쿼리 개선하기 (0) | 2023.10.26 |
---|---|
you do not have the SUPER privilege (Error Code: 1419) (0) | 2023.09.20 |
NOW()와 SYSDATE()의 차이 (0) | 2023.09.05 |
계층형 쿼리 (0) | 2023.08.17 |
[MySQL] YEAR_MONTH() 현재 연도, 월 알아내기 (0) | 2023.07.17 |