select case
when category = 1 and supplierId = 1 then ..
when .. then ..
else 'etc'
end as categoryName, * -- 두개의 field 가능
from products
select case
when categoryID = 1 then '음료'
when categoryID = 2 then 'source'
else 'etc'
end as new_category
, avg(price)
from producdts
group by categoryID
-- case 절의 순서를 주의하자 ex) 정삼각형 -> 이등변 삼각형 -> ...
table pivot
select
avg(case when categoryId = 1 then price else null end) as avgPrice_1
avg(case when categoryId = 2 then price else null end) as avgPrice_2
from products