Study - Problems(IT)/LeetCode - SQL
1141.User Activity for the Past 30 Days I
Dev.D
2024. 11. 21. 22:12
* Problem
Write a solution 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.
Return the result table in any order.
* Explanation
Note that we do not care about days with zero active users.
* Solution (Success)
# Write your MySQL query statement below
SELECT
activity_date AS day,
COUNT(DISTINCT user_id) AS active_users
FROM Activity
WHERE activity_date BETWEEN '2019-06-28' AND '2019-07-27'
GROUP BY 1;