커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
round 쿼리를 쓸 때 alias를 이용하면 안 되나요?
[왕초보] 엑셀보다 쉬운, SQL v3
3주차
북마크
김*마
댓글
3
추천
0
조회수
6
조회수
6
답변 완료

예를 들어 아래와 같은 쿼리에서,


select count(point_user_id) as pnt_user_cnt,

      count(*) as tot_user_cnt,

     round(count(point_user_id)/count(*),2) as ratio

  from users u

  left join point_users pu on u.user_id = pu.user_id

  where u.created_at between '2020-07-10' and '2020-07-20'



count(point_user_id)를 pnt_user_cnt로,

count(*)를 tot_user_cnt로 각각 alias를 지정해 주었는데요.

round 쿼리를 쓸 때

round (pnt_user_cnt/tot_user_cnt) 라고 쓰면 안 되는 것인가요?


항상 감사합니다 :)



취소
 공유
취소
댓글 0
댓글 알림
나의얼굴