[프로그래머스 SQL 고득점 Kit] SELECT: 조건에 맞는 도서 리스트 출력하기
문제 정답 SELECT BOOK_ID, DATE_FORMAT(PUBLISHED_DATE, '%Y-%m-%d') AS PUBLISHED_DATE FROM BOOK WHERE YEAR(PUBLISHED_DATE) = 2021 AND CATEGORY LIKE '%인문%' ORDER BY PUBLISHED_DATE
문제 정답 SELECT BOOK_ID, DATE_FORMAT(PUBLISHED_DATE, '%Y-%m-%d') AS PUBLISHED_DATE FROM BOOK WHERE YEAR(PUBLISHED_DATE) = 2021 AND CATEGORY LIKE '%인문%' ORDER BY PUBLISHED_DATE
문제 정답 SELECT FACTORY_ID, FACTORY_NAME, ADDRESS FROM FOOD_FACTORY WHERE ADDRESS LIKE '%강원도%' ORDER BY FACTORY_ID
문제 정답 SELECT * FROM ANIMAL_INS ORDER BY ANIMAL_ID
문제 정답 SELECT USER_ID, PRODUCT_ID FROM ONLINE_SALE GROUP BY USER_ID, PRODUCT_ID HAVING COUNT(*) >= 2 ORDER BY USER_ID ASC, PRODUCT_ID DESC
문제 정답 (SELECT DATE_FORMAT(SALES_DATE, "%Y-%m-%d") AS SALES_DATE, PRODUCT_ID, USER_ID, SALES_AMOUNT FROM ONLINE_SALE AS A WHERE MONTH(SALES_DATE) = 03 UNION SELECT DATE_FORMAT(SALES_DATE, "%Y-%m-%d") AS SALES_DATE, PRODUCT_ID, NULL AS USER_ID, SALES_AMOUNT FROM OFFLINE_SALE AS B WHERE MONTH(SALES_DATE) = 03 ) ORDER BY SALES_DATE, PRODUCT_ID, USER_ID
문제 정답 SELECT NAME, DATETIME FROM ANIMAL_INS ORDER BY ANIMAL_ID DESC
문제 정답 SELECT ANIMAL_ID, NAME FROM ANIMAL_INS WHERE INTAKE_CONDITION = 'Sick' ORDER BY ANIMAL_ID
문제 정답 SELECT ANIMAL_ID, NAME FROM ANIMAL_INS WHERE INTAKE_CONDITION != 'Aged' ORDER BY ANIMAL_ID ASC
문제 정답 SELECT ANIMAL_ID, NAME FROM ANIMAL_INS ORDER BY ANIMAL_ID
문제 정답 SELECT ANIMAL_ID, NAME, DATETIME FROM ANIMAL_INS ORDER BY NAME ASC, DATETIME DESC