SELECT(1) | MySQL
September 22, 2023
MySQL프로그래머스
SELECT FLAVOR
FROM FIRST_HALF
ORDER BY TOTAL_ORDER DESC, SHIPMENT_ID ASC
;
SELECT A.FLAVOR
FROM FIRST_HALF A INNER JOIN ICECREAM_INFO B
ON A.FLAVOR = B.FLAVOR
WHERE (A.TOTAL_ORDER > 3000) AND (B.INGREDIENT_TYPE = 'fruit_based')
ORDER BY A.TOTAL_ORDER DESC
;
SELECT FACTORY_ID, FACTORY_NAME, ADDRESS
FROM FOOD_FACTORY
WHERE ADDRESS LIKE '강원도%'
;
SELECT A.TITLE, A.BOARD_ID, B.REPLY_ID, B.WRITER_ID, B.CONTENTS,
DATE_FORMAT(B.CREATED_DATE, '%Y-%m-%d') AS CREATED_DATE
FROM USED_GOODS_BOARD AS A INNER JOIN USED_GOODS_REPLY AS B
ON A.BOARD_ID = B.BOARD_ID
WHERE SUBSTR(A.CREATED_DATE,1,7) = '2022-10'
ORDER BY CREATED_DATE ASC, A.TITLE ASC
;
SELECT BOOK_ID, DATE_FORMAT(PUBLISHED_DATE, '%Y-%m-%d') AS PUBLISHED_DATE
FROM BOOK
WHERE (CATEGORY = '인문') AND (SUBSTR(PUBLISHED_DATE,1,4) = '2021')
;
- DATE_FORMAT
- DATE_FORMAT(date, format)
- SUBSTR
- SUBSTR(string, start, length)