코딩테스트 풀이/SQL
[LeetCode/Easy] 1141. User Activity for the Past 30 Days I
무지맘
2023. 6. 8. 12:43
1. Input
1) Table: Activity (pk: 없음)
2. Output
1) 2019년 7월 27일까지의 30일동안 각 날짜마다 액티비티를 즐긴 사람들의 수를 출력
- 출력 순서는 상관 없다.
3. Example
4. Code
1) 첫 코드(2023/06/08)
select activity_date as day, count(user_id) as active_users
from (
select user_id , activity_date
from Activity
where activity_date between '2019-06-28' and '2019-07-27'
group by user_id, activity_date
) a
group by day;
- 33%