문제 정답 SELECT B.PRODUCT_ID, A.PRODUCT_NAME, SUM(AMOUNT) * PRICE AS TOTAL_SALES FROM FOOD_PRODUCT AS A JOIN FOOD_ORDER AS B ON A.PRODUCT_ID = B.PRODUCT_ID WHERE PRODUCE_DATE LIKE '%2022-05%' GROUP BY PRODUCT_ID ORDER BY TOTAL_SALES DESC, PRODUCT_ID ASC
문제 정답 SELECT A.NAME, A.DATETIME FROM ANIMAL_INS AS A LEFT JOIN ANIMAL_OUTS AS B ON A.ANIMAL_ID = B.ANIMAL_ID WHERE B.DATETIME IS NULL ORDER BY A.DATETIME LIMIT 3
문제 정답 SELECT B.APNT_NO, PT_NAME, C.PT_NO, B.MCDP_CD, A.DR_NAME, B.APNT_YMD FROM DOCTOR AS A JOIN APPOINTMENT AS B ON A.DR_ID = B.MDDR_ID JOIN PATIENT AS C ON B.PT_NO = C.PT_NO WHERE APNT_YMD LIKE '2022-04-13%' AND APNT_CNCL_YN = 'N' AND B.MCDP_CD = 'CS' ORDER BY APNT_YMD
문제 정답 SELECT ORDER_ID, PRODUCT_ID, DATE_FORMAT(OUT_DATE, '%Y-%m-%d') AS OUT_DATE, CASE WHEN OUT_DATE '2022-05-01' THEN '출고대기' ELSE '출고미정' END 출고여부 FROM FOOD_ORDER ORDER BY ORDER_ID
문제 정답 SELECT CONCAT('/home/grep/src/', B.BOARD_ID, '/', FILE_ID, FILE_NAME, FILE_EXT) AS FILE_PATH FROM USED_GOODS_BOARD AS A JOIN USED_GOODS_FILE AS B ON A.BOARD_ID = B.BOARD_ID WHERE VIEWS = (SELECT MAX(VIEWS) FROM USED_GOODS_BOARD) ORDER BY FILE_ID DESC
문제 정답 SELECT DISTINCT A.CAR_ID FROM CAR_RENTAL_COMPANY_CAR AS A JOIN CAR_RENTAL_COMPANY_RENTAL_HISTORY AS B ON A.CAR_ID = B.CAR_ID WHERE CAR_TYPE = '세단' AND START_DATE LIKE '2022-10%' ORDER BY A.CAR_ID DESC
문제 정답 SELECT PRODUCT_CODE, SUM(PRICE * SALES_AMOUNT) AS SALES FROM PRODUCT AS A JOIN OFFLINE_SALE AS B ON A.PRODUCT_ID = B.PRODUCT_ID GROUP BY PRODUCT_CODE ORDER BY SALES DESC, PRODUCT_CODE ASC