커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
with 문 관련 질문
[왕초보] 엑셀보다 쉬운, SQL
4주차
북마크
장*희
댓글
3
추천
0
조회수
6
조회수
6
답변 완료


4-6 with절 연습하기 에서


with table1 as (

select course_id , count(distinct(user_id)) as cnt_checkins from checkins c 

group by course_id

), table2 as (

select course_id, count(*) as cnt_total from orders

group by course_id

)


select c.title,

    a.cnt_checkins,

    b.cnt_total,

    (a.cnt_checkins/b.cnt_total) as ratio

from table1 a

inner join table2 b on a.course_id = b.course_id

inner join courses c on a.course_id = c.course_id


이렇게 작성했더니

SQL Error [1146] [42S02]: Table 'sparta.table1' doesn't exist

이런 error 메세지가 출력됐습니다.


강의 내용상 with절로 작성된 쿼리는 임시 table로 인식된다고 하셨는데, 해당 테이블이 없다는게 이해되지 않습니다.



스파르타 즉문즉답




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