SQL 문제
[solvesql_Level3] 작품이 없는 작가 찾기
빙수빈수
2023. 10. 14. 09:39
https://solvesql.com/problems/artists-without-artworks/
https://solvesql.com/problems/artists-without-artworks/
solvesql.com
[코드]
select a.artist_id, a.name
from artists as a
left outer join artworks_artists as b
on a.artist_id = b.artist_id
where b.artist_id is null and a.death_year is not null
[고찰]
이번 문제는 artists 테이블에서 artowrks_artists의 테이블과 중복되는 부분을 제거하여 MoMA에 등록은 되어있는 작가지만 전시한 작품은 없는 컬럼을 뽑아내는 문제였다. 이를 위해서 left outer join을 사용하고 artworks_artists의 조인속성 값이 null인 컬럼을 출력하면 되는 간단한 문제였다.