sql_코드카타(2023.12.20)

김수경·2023년 12월 20일

코드카타

목록 보기
7/29
  1. 천재지변으로 인해 일부 데이터가 유실되었습니다. 입양을 간 기록은 있는데, 보호소에 들어온 기록이 없는 동물의 ID와 이름을 ID 순으로 조회하는 SQL문을 작성해주세요.
#inner join을 통해 animal_ins가 null인 필터를 사용한다.
SELECT o.animal_id,
o.name
from animal_outs o left join animal_ins i on i.animal_id = o.animal_id
where i.animal_id is null 
order by 1 
  1. 상반기 아이스크림 총주문량이 3,000보다 높으면서 아이스크림의 주 성분이 과일인 아이스크림의 맛을 총주문량이 큰 순서대로 조회하는 SQL 문을 작성해주세요.
SELECT a.flavor 
from first_half a inner join icecream_info b on a.flavor=b.flavor 
where a.total_order >= 3000 and b.ingredient_type = 'fruit_based'
order by a.total_order desc 
profile
잘 하고 있는겨?

0개의 댓글