
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
오류가 뜨는데 어디서 오류가 있는지 모르겠어서요

SELECT restaurant_name,
price_group,
age_group,
case when avg_price<=5000 then price_group1
when avg_price>5000 and avg_price<=10000 then price_group2
when avg_price>10000 and avg_price<=30000 then price_group3
ELSE price_group4 END price_group
case when avg_age >=20 and avg_age<30 then age_group1
when avg_age >=30 and avg_age<40 then age_group2
when avg_age >=40 and avg_age<50 then age_group3
when avg_age>50 then age_group4 end age_group
FROM
(
SELECT avg(price) avg_price,
AVG(age) avg_age
FROM food_orders f inner join customers c on f.customer_id = c.customer_id
) t
order by 1
