Menu
Coddy logo textTech

Recap - Join

Coddy SQL 여정의 기초 섹션에 포함된 레슨. 72개 중 45번째.

challenge icon

챌린지

중급

사용 가능한 테이블 및 열:

  • <strong>orders</strong>: <strong>id</strong>, <strong>customer_id</strong>
  • <strong>products</strong>: <strong>id</strong>, <strong>unit_price</strong>, <strong>units_in_stock</strong>
  • <strong>order_items</strong>: <strong>id</strong>, <strong>order_id</strong>, <strong>product_id</strong>, <strong>quantity</strong>

unit_price10 미만인 제품을 주문한 고객의 customer_id를 찾고, 해당 고객이 주문한 저렴한 제품의 전체 quantity 합계를 조회하세요.

다음 열을 반환하세요:

  • customer_id
  • total_quantity (각 고객별 unit_price < 10 인 제품 수량의 합계)

직접 해보기

-- 작업에서 요청하는 그룹화 열과 집계 값을 나열하세요
SELECT ____
FROM orders
-- 각 조인에는 id 열을 그것을 가리키는 열과 일치시키는 조건이 필요합니다
INNER JOIN order_items ON ____
INNER JOIN products ON ____
-- 그런 다음 작업에서 설명하는 임계값을 충족하는 행만 유지하세요
WHERE ____
GROUP BY orders.customer_id;

기초의 모든 레슨

직접 연습해 보세요: SQL 플레이그라운드