#39. JOIN : 조건에 맞는 도서와 저자 리스트 출력하기 | 프로그래머스 | SQL 고득점 Kit

문제

 

입력 코드

1. INNER JOIN

SELECT 
    BOOK_ID, 
    AUTHOR_NAME, 
    DATE_FORMAT(PUBLISHED_DATE, '%Y-%m-%d') AS PUBLISHED_DATE
FROM BOOK
    INNER JOIN AUTHOR
    ON BOOK.AUTHOR_ID = AUTHOR.AUTHOR_ID
WHERE CATEGORY = '경제'
ORDER BY PUBLISHED_DATE ASC;

 

2. ALIAS (별칭) 활용

SELECT 
    BOOK_ID, 
    AUTHOR_NAME, 
    DATE_FORMAT(PUBLISHED_DATE, '%Y-%m-%d') AS PUBLISHED_DATE
FROM BOOK AS B
    JOIN AUTHOR AS A
    ON B.AUTHOR_ID = A.AUTHOR_ID
WHERE B.CATEGORY = '경제'
ORDER BY B.PUBLISHED_DATE ASC;

 

코드 설명

#SELECT #JOIN #DATE_FORMAT #ORDER BY #WHERE #ALIAS

 

문제 출처

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