Observed-User Percentage by App
Problem statement
Table app_installs stores each app's total installed-user count. Table app_observations stores user observations by app and date.
For every app in app_installs, return the percentage of installed users who appear at least once in app_observations. Count distinct user IDs across all dates, round the percentage to two decimal places, include apps with no observations as zero, and order rows by app ascending.
Table schema
MySQLPostgreSQLPandas
Use the same input data with any supported language. Open the Schema tab in the editor to see the generated SQL setup or Pandas DataFrames.
app_installs
| Column | Type | Nullable | Description |
|---|---|---|---|
| app | Text | No | — |
| installed_users | Integer | No | — |
app_observations
| Column | Type | Nullable | Description |
|---|---|---|---|
| app | Text | No | — |
| user_id | Text | No | — |
| observed_date | Date | No | — |
Expected result
Your query or function must return these columns.
| Column | Type | Nullable | Description |
|---|---|---|---|
| app | Text | No | — |
| observed_percentage | Decimal | No | — |
Row order: must match exactly. Numeric tolerance: 0.005.
Constraints
installed_usersis positive for every app.- Repeated observations of the same user and app count once.
- Observation rows for apps absent from
app_installsare excluded. - The result columns are
appandobserved_percentage.