소수점 반올림, 버림

hyunwoo·2022년 10월 4일
0

Mysql

목록 보기
2/9

select sum(saleprice) as Total, avg(saleprice) as Average, min(saleprice) as Minimum, max(saleprice) as Maximum from orders;

위의 그림의 경우 Average의 값이 소수점이 붙어있는 상태로 나온다.
소수점 아래를 제거하기 위해 아래와 같이 FLOOR 함수로 묶어주면

select sum(saleprice) as Total, FLOOR(avg(saleprice)) as Average, min(saleprice) as Minimum, max(saleprice) as Maximum from orders;


이렇게 Average의 소수점이 사라진다.

0개의 댓글