Algorithm & SQL/SQL

[solvesql] SQL 문제 풀이 (2)

YoonJong 2023. 1. 30. 14:28
728x90
반응형

1. 레스토랑 웨이터의 팁 분석

select 
  day,
  time,
  round(avg(tip),2) as avg_tip,
  round(avg(size),2) as avg_size
from tips
group by day, time;

 

2. 최근 올림픽이 개최된 도시

select 
  year,
  upper(substring(city,0,4)) as city
from games
where year >= 2000
order by year desc;

 

3.우리 플랫폼에 정착한 판매자 1

select 
  seller_id,
  count(distinct(order_id)) as orders
from olist_order_items_dataset
group by seller_id
having orders >= 100;
728x90
반응형