activity_date
and user_id
columns from the Activity
table.DATEDIFF
function to calculate the difference in days between '2019-07-27' and the activity_date
.activity_date
.COUNT(DISTINCT user_id)
function to count the number of unique active users for each day.activity_date
as day
and the count as active_users
in the SELECT statement.erDiagram Activity { int user_id int session_id date activity_date enum activity_type }