if(조건, 조건을 충족할 때, 조건을 충족하지 못할 때)
select restaurant_name,
cuisine_type "원래 음식 타입",
if(cuisine_type='Korean', '한식', '기타') "음식 타입"
from food_orders

위처럼 if문을 사용해 한가지의 조건을 만들었지만 조건을 지정하다보면 2개 이상의 조건을 지정해야하는 경우가 생길때가 있다. 이 때 사용하는것이 바로 아래 case 문이다.
예시) 음식 단가를 주문 수량이 1일 때는 음식 가격, 주문 수량이 2개 이상일 때는 음식가격/주문수량 으로 지정할때는
case when 조건1 then 값(수식)1
when 조건2 then 값(수식)2
else 값(수식)3
end
select order_id,
price,
quantity,
case when quantity=1 then price
when quantity>=2 then price/quantity end "음식 단가"
from food_orders
