-- 출간년도가 2000년 이상인 책들을 '최근책'
-- 아닌것 들을 '예전책' 이라고 하는 type 컬럼을 만들자.
select *,
case
when released_year >= 2000 then '최근책'
else '예전책'
end as type
from books;
-- 조건이 2개인 경우, if 함수를 사용해도 된다.
select *,
if(released_year >= 2000, '최근책', '예전책') as type
from books;
-- ifnull() 함수
select *,
ifnull(stock_quantity, 0)
from books;