Coding Test
[SQL 프로그래머스] 조건에 맞는 도서와 저자 리스트 출력하기
hyungminjeon
2024. 6. 25. 14:40
[문제]

[해결]
SELECT book_id,author_name, date_format(published_date, "%Y-%m-%d")
from book b join author a on b.author_id = a.author_id
where b.category = "경제"
order by published_date
[정리 및 새롭게 알게 된 점]
먼저 author 테이블과 book 테이블을 uthor_id를 기준으로 inner join 한 다음 category가 "경제"인 부분만을 where절로 제한시키고 published_date 열은 date_format() 함수를 통해 "%Y-%m-%d" 형태로 나타내었다. 마지막으로 published_date를 기준으로 오름차순 정렬하여 문제를 해결하였다.