
위와 같이 rating에 사용할 수 없는 값 Not given이 있다.
select restaurant_name,
avg(rating) average_of_rating,
avg(if(rating<>'Not given', rating, null)) average_of_rating2
from food_orders
group by 1
# 사용할 수 없는 값 Not given을 null값 즉 0으로 간주하는 값으로 제외해줬다.

where (지정컬럼) IS NOT NULL하지만 더욱 명확하게 NULL값을 처리해주기 위해 NULL문법을 사용한다.
select a.order_id, a.customer_id, a.restaurant_name, a.price, b.name, b.age, b.gender from food_orders a left join customers b on a.customer_id=b.customer_id where b.customer_id is not null #where 조건절에 is not null (null값을 제외하고 조회할 수 있도록 했다)
select a.order_id,
a.customer_id,
a.restaurant_name,
a.price,
b.name,
b.age,
coalesce(b.age, 20) "null 제거",
b.gender
from food_orders a left join customers b on a.customer_id=b.customer_id
where b.age is null
#null 값인 age를 coalesce로 제거해서 20으로 대체한다.
