BOOK 테이블에서 2021년에 출판된 '인문' 카테고리에 속하는 도서 리스트를 찾아서 도서 ID(BOOK_ID), 출판일 (PUBLISHED_DATE)을 출력하는 SQL문을 작성해주세요.
결과는 출판일을 기준으로 오름차순 정렬해주세요.
DATE_FORMAT(date, format)
Formats the date value according to the format string. If either argument is NULL, the function returns NULL.
%Y: 2023, %y:23 을 의미
YEAR(date)
Returns the year for date, in the range 1000 to 9999, or 0 for the “zero” date. Returns NULL if date is NULL.
DATE(expr)
Extracts the date part of the date or datetime expression expr. Returns NULL if expr is NULL.
SELECT
book_id,
DATE_FORMAT(published_date,'%Y-%m-%d')
FROM book
WHERE YEAR(published_date)='2021'
AND category='인문'
ORDER BY published_date;