WHERE DATE LIKE '2022-01%'
1. Date Format
WHERE DATE_FORMAT(DATE, '%Y-%m') BETWEEN '2022-08' and '2022-10'
2.
SELECT 열_이름
FROM 테이블_이름
JOIN B ON A.PK = B.PK
WHERE 조건식
GROUPBY 열_이름
HAVING 조건식
ORDERBY 열_이름
LIMIT 숫자
3. ex) 음식 종류별 예약횟수 --> SUBQUERY
where (food_type, reservations) in (select food_type, max(reservations)
from rest_info
group by food_type
)
4. 2022년 10월 추출
WHERE DATE LIKE '2022-10%'
WHERE NAME LIKE "_BCD%"
ABCDEF --> O
AABCD --> X
5. extract YEAR from DATE TYPE
YEAR(SALES_DATE)
6.
COUNT(DISTINCT SALES)