문제 링크

https://school.programmers.co.kr/learn/courses/30/lessons/133025

 

풀이

두가지 방법으로 풀었다.

첫번째는 서브쿼리를 사용하였고, 두번째는 join을 사용했다

 

코드

# 서브쿼리
select flavor
from first_half
where total_order > 3000 and flavor in (
    select flavor
    from icecream_info
    where ingredient_type = 'fruit_based'
)
order by total_order desc;

# 조인
select first_half.flavor
from first_half join icecream_info
on first_half.flavor = icecream_info.flavor
where total_order > 3000 and ingredient_type = 'fruit_based'
order by total_order desc;