November 10, 2022
SELECT AGE, GENDER
FROM table1
WHERE AGE > 12 AND GENDER = 'W';
SELECT GENDER
FROM table1
WHERE GENDER IN ('W', 'M');
-- WHERE GENDER = 'W' OR GENDER = 'M';
SELECT GENDER
FROM table1
WHERE NOT GENDER IN ('W', 'M');
-- WHERE GENDER != 'W' AND GENDER != 'M';
SELECT MAX(age), MIN(age)
FROM table1;
SELECT COALESCE(FREEZER_YN, 'N'), IFNULL(FREEZER_YN, 'N')
FROM table1;
SELECT DATE_FORMAT(HIRE_YMD, '%Y-%m-%d')
FROM table1;
SELECT HIRE_YMD
FROM table1
WHERE YEAR(HIRE_YMD) = 2022;
SELECT COUNT(*) AS NO_AGE
FROM table1
WHERE AGE IS NULL;
SELECT AGE, GENDER
FROM table1
LIMIT 1;
SELECT IF(DATEDIFF(END_DATE, START_DATE)+1>=30, '장기 대여', '단기 대여') AS RENT_TYPE
FROM COMPANY