New-User Devices That Opened an App
Problem statement
Tables app_opens and device_users describe application activity and whether each known device belongs to a new user.
Return one row containing the number of distinct known new-user devices with at least one activity row whose open_count is positive.
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_opens
| Column | Type | Nullable | Description |
|---|---|---|---|
| device_id | Text | No | — |
| app_name | Text | No | — |
| open_count | Integer | No | — |
device_users
| Column | Type | Nullable | Description |
|---|---|---|---|
| device_id | Text | No | — |
| is_new | Boolean | No | — |
Expected result
Your query or function must return these columns.
| Column | Type | Nullable | Description |
|---|---|---|---|
| new_device_count | Integer | No | — |
Row order: must match exactly. Numeric tolerance: 0.
Constraints
- A device can appear in multiple
app_opensrows and must be counted once. - Rows with
open_count = 0do not qualify. - Activity for a device absent from
device_usersdoes not qualify. - Always return one row, including a zero count.