문제
SQLite
내가 작성한 오답
-- 1 : 2021-01-31 이라고 하면 2021-01-31 00:00:00으로 인식된다
select bike_id
from rental_history
where rent_at between '2021-01-01' and '2021-01-31'
group by bike_id
having sum(distance) >= 50000;
-- 2 : %y로 하니까 명확하지 않은지 데이터가 출력이 안됐다
select bike_id
from rental_history
where strftime('%y%m', rent_at) = '2101'
group by bike_id
having sum(distance) >= 50000;내가 작성한 정답
select bike_id
from rental_history
where rent_at between '2021-01-01' and '2021-02-01'
group by bike_id
having sum(distance) >= 50000;
select bike_id
from rental_history
where strftime('%Y%m', rent_at) = '202101'
group by bike_id
having sum(distance) >= 50000;Share article