Active User Stickiness

ASKED IN INTERVIEW
4pts
Meta

Problem Statement

Meta uses the "Stickiness" metric to understand user retention. Stickiness is the ratio of Daily Active Users (DAU) to Monthly Active Users (MAU).

Write an SQL query to calculate the stickiness for the month of July 2022.

Rules:

  • DAU (Daily Active Users): The average number of unique users active per day throughout the month.
  • MAU (Monthly Active Users): The total number of unique users active at least once during the entire month.
  • An "active" user is defined as any user found in the user_actions table for that period.
  • The result should be a single column named stickiness, rounded to 4 decimal places.
  • Only consider data from July 2022.
Tests your understanding of
Metrics, Ratio, Dates and Engagement

Input Tables

user_actions
user_id(INTEGER)event_id(INTEGER)event_type(VARCHAR)event_date(TIMESTAMP)
1101post2022-07-01 10:00:00
1102like2022-07-02 11:00:00
2103post2022-07-01 12:00:00
2104post2022-07-01 13:00:00
3105like2022-07-05 09:00:00
4106login2022-07-10 14:00:00
1107post2022-07-10 15:00:00
5108post2022-07-20 10:00:00
2109like2022-07-20 11:00:00
1110post2022-07-31 23:00:00
6111login2022-06-30 23:00:00
7112login2022-08-01 01:00:00
user_profiles
user_id(INTEGER)account_type(VARCHAR)
1Personal
2Business
activity_logs
log_id(INTEGER)user_id(INTEGER)session_duration(INTEGER)
11300

Expected Output

stickiness(DECIMAL)
0.3

Tags

MediumASKED IN INTERVIEWMetricsRatioDatesEngagement
20-25 min
48%

Hints