문제
Jill과 Eva가 주문한 주문 내역을 찾으세요.
Jill과 Eva는 고객의 이름으로 간주하세요.
주문 날짜, 세부 사항 및 비용과 함께 첫 번째 이름을 출력하세요.
고객 ID를 기준으로 오름차순으로 주문 기록을 정렬하세요.
테이블설명
예상결과
✏️ 풀이
SELECT c.first_name, o.order_date, o.order_details, o.total_order_cost
FROM orders AS o
JOIN customers AS c ON o.cust_id = c.id
WHERE c.first_name IN ('Jill', 'Eva')
ORDER BY cust_id;
1. 'Jill', 'Eva'를 찾기 위해 WHERE절에서 IN으로 두 데이터를 필터
'[코딩테스트] > [SQL]' 카테고리의 다른 글
[StrataScratch - SQL] (Easy) Highly Reviewed Hotels (2) | 2025.04.24 |
---|---|
[StrataScratch - SQL] (Easy) Customer Details (0) | 2025.04.23 |
[StrataScratch - SQL] (Easy) Average Salaries (0) | 2025.04.22 |
[StrataScratch - SQL] (Easy) Email Preference Missing (2) | 2025.04.22 |
[StrataScratch - SQL] (Easy) Number of violations (0) | 2025.04.21 |