🤔 문제 분석
1) Write an SQL query to find the daily active user count for a period of 30 days ending 2019-07-27 inclusively. A user was active on someday if they made at least one activity on that day.
2) Return the result table in any order.
💡 풀이
SELECT activity_date AS day, count(DISTINCT user_id) AS active_users
FROM Activity
WHERE activity_date > "2019-06-27"
AND activity_date < "2019-07-28"
GROUP BY activity_date
'코딩테스트 > 리트코드 SQL' 카테고리의 다른 글
[리트코드/SQL] 22. Find Followers Count (1729) (0) | 2022.12.18 |
---|---|
[리트코드/SQL] 21. Daily Leads and Partners (1693) (0) | 2022.12.18 |
[리트코드/SQL] 19. Sales Person (607) (0) | 2022.12.18 |
[리트코드/SQL] 18. Rising Temperature (197) (0) | 2022.12.18 |
[리트코드/SQL] 17. Article Views I (1148) (0) | 2022.12.18 |
댓글