select food_preparation_time,
delivery_time,
food_preparation_time + delivery_time as total_time
from food_orders
select sum(food_preparation_time) total_food_preparation_time,
avg(delivery_time) avg_delivery_time
from food_orders
select AVG(age) as avg_age
from customers
select count(1) count_of_orders,
count(distinct customer_id) count_of_customers
from food_orders
select count(1) as total_count,
count(distinct pay_type) count_of_pay_type
from payments
select min(price) min_price,
max(price) max_price
from food_orders
elect count(1) count_of_orders
from food_orders
where price >= 30000
select AVG(price) as avg_price
from food_orders
where cuisine_type ='Korean'
=> 액셀에서 정렬과도 같음
1) 평균가격 순으로 정렬 / 내림차순의 경우 desc
select cuisine_type,
sum(price) sum_of_price
from food_orders
group by cuisine_type
order by sum_of_price
select restaurant_name, MAX(price) as max_price
from food_orders
group by restaurant_name
order by max_price desc
select pay_type , max(`date`) as recent_date
from payments
group by pay_type
2) 가격 총합으로 정렬
select cuisine_type,
sum(price) sum_of_price
from food_orders
group by cuisine_type
order by sum(price) DESC
Q : 음식 종류별 가격의 최대값, 최소값, 가격별로 정렬하기
A :
select cuisine_type, MAX(price) max_price, MIN(price) min_price
from food_orders
group by cuisine_type
order by price