목록2024/08 (21)
haju__log
SELECT COUNT(USER_ID) AS USERSFROM USER_INFOWHERE JOINED LIKE '2021-%' AND (AGE BETWEEN 20 AND 29); ✅ BETWEEN 구문 : 조건 범위 지정SELECT 8FROM TABLE_NAMEWHERE 컬럼명 BETWEEN 조건1 AND 조건2BETWEEN A AND B 는 A이상 B이하 이다.
SELECT TITLE,A.BOARD_ID,REPLY_ID,B.WRITER_ID,B.CONTENTS,DATE_FORMAT(B.CREATED_DATE,"%Y-%m-%d") AS CREATED_DATEFROM USED_GOODS_BOARD A INNER JOIN USED_GOODS_REPLY B ON A.BOARD_ID=B.BOARD_ID WHERE A.CREATED_DATE LIKE '2022-10-%'ORDER BY CREATED_DATE ASC, TITLE ASC; ✅ ORDER BY A.CREATED_DATE ASC, TITLE ASC; 이렇게 줘서 오류가 발생했음 >> SELECT 쿼리문 실행 순서를 참고하면 제일마지막에 정렬을 하므로, A.CREATED_DATE가 아닌, 컬럼명인 CR..
SELECT A.FLAVORFROM FIRST_HALF A LEFT JOIN ICECREAM_INFO B ON A.FLAVOR=B.FLAVOR WHERE TOTAL_ORDER >=3000 AND INGREDIENT_TYPE='fruit_based'ORDER BY TOTAL_ORDER DESC;
SELECT BOOK_ID,DATE_FORMAT(PUBLISHED_DATE,"%Y-%m-%d") AS PUBLISHED_DATEFROM BOOKWHERE CATEGORY='인문' AND PUBLISHED_DATE LIKE "2021%"ORDER BY PUBLISHED_DATE ASC; ✅ DATE_FORMAT : 날짜 형식 지정DATE_FORMAT("날짜값"/날짜컬럼,"형식");%Y : 년도 표현 4자리%y : 년도 표현 2자리%M : 달 표현 이름으로 Full Name (January to December)%m : 달 표현을 숫자로 (00 to 12)%d : 일 표현 (01 to 31)