![](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbBGSoB%2FbtsLKGnNkiq%2F8xKFQKeoIlkzgoRHupR7v0%2Fimg.png)
전체 매출의 상위 20%를 차지하는 제품 구하기 (BDA학회 SQL 문법 기초 연습반)
·
대외활동 및 인턴/빅데이터 분석 학회 BDA
전체 매출의 상위 20%를 차지하는 제품이 무엇인가?1단계 : 제품별 각 주문 건에 대한 매출 합 매출 = quantity(order_details) * price(products)product_id로 join 해서 구해야 한다.select od.order_detail_id, od.product_id, od.quantity, p.price, (od.quantity * p.price) as order_detail_revenuefrom order_details odjoin products p on od.product_id = p.product_idorder by product_id;+ 추가로 확인하면 도움 되는 글[대외활동 및 인턴/빅데이터 분석 학회 BDA] - 테이블 ..