https://solvesql.com/problems/

난이도 1

데이터 그룹으로 묶기

1
2
3
4
5
6
7
select quartet,
  round(avg(x), 2) as x_mean,
  round(variance(x), 2) as x_var,
  round(avg(y), 2) as y_mean,
  round(variance(y), 2) as y_var
from points
group by quartet;

몇 분이서 오셨어요?

1
select * from tips where size % 2 = 1

최근 올림픽이 개최된 도시

1
2
3
4
select year, UPPER(SUBSTR(city,1, 3)) AS city 
from games 
where year >= 2000 
order by year desc

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

1
2
3
4
select seller_id, COUNT(DISTINCT(order_id)) as orders 
from olist_order_items_dataset
group by seller_id
having orders >= 100;

최고의 근무일을 찾아라

1
2
3
4
5
select day, round(sum(tip), 3) as tip_daily
from tips
group by day
order by sum(tip) DESC
limit 1

첫 주문과 마지막 주문

1
2
3
4
select STRFTIME('%Y-%m-%d', MIN(order_purchase_timestamp)) AS first_order_date,
       STRFTIME('%Y-%m-%d', MAX(order_purchase_timestamp)) AS last_order_date
from olist_orders_dataset

Leave a comment