카테고리 없음

TIL_250427 (일)

elya0919 2025. 4. 28. 02:33

오늘 학습목표 = SQL 3주차 if,case문 복습

 

if

=if ( ~ 일 때, 참, 거짓)

[실습1]
음식 타입을 ‘Korean’ 일 때는 ‘한식’, ‘Korean’ 이 아닌 경우에는 ‘기타’ 라고 지정

select restaurant_name ,
cuisine_type as '원래 음식 타입',
if(cuisine_type = 'Korean', '한식', '기타') as '바뀐 음식 타입'
from food_orders

 

if 쿼리 결과 값

case

= case when ~ 일 때 then 참, when ~ 일 때 then 참  

 

user segmentation

= case문 사용

case when ~ 일 때 then 참(그룹), when ~ 일 때 then 참(그룹)

 

오류