Snoopy [리트코드/SQL] 20. User Activity for the Past 30 Days I (1141)
코딩테스트/리트코드 SQL

[리트코드/SQL] 20. User Activity for the Past 30 Days I (1141)

Sooyoon Jeong 2022. 12. 18.

목차

 

🤔 문제 분석

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

 

댓글