User Churn
Question
You're given a table called userActivityLogs. This table contains data on each time a user opens into Application X. Below is some sample data from this table. You can assume this table has all the historical data one would expect (this table will be large assuming Application X has a number of loyal users).
userid | date | session_duration_ms | start_timestamp | end_timestamp |
---|---|---|---|---|
139281 | 2019-01-01 | 21240 | 1546300800 | 1546322040 |
139281 | 2019-01-02 | 21600 | 1546401600 | 1546423200 |
Application X defines an active user as one that has opened the application within the last 30 days. Using SQL, can you write a query that outputs users who are inactive? Your output should have userid and the number of days since the last login.