Loading problem...
You are analyzing telemetry from an online gaming platform.
The dataset activity records daily login activity with the following columns:
player_id: unique player identifierdevice_id: identifier of the device used on that login dayevent_date: login date in YYYY-MM-DD formatgames_played: number of games played that dayEach player can appear across multiple dates, but each (player_id, event_date) pair is unique.
Your task is to return the device used on the first login date for every player.
Return exactly these columns:
player_iddevice_idResult ordering is not important unless your local checker requires deterministic ordering.
This problem should be solvable in both:
Activity:
| player_id | device_id | event_date | games_played |
|-----------|-----------|-------------|--------------|
| 1 | 2 | 2016-03-01 | 5 |
| 1 | 2 | 2016-05-02 | 6 |
| 2 | 3 | 2017-06-25 | 1 |
| 3 | 1 | 2016-03-02 | 0 |
| 3 | 4 | 2018-07-03 | 5 |[
{"player_id":1,"device_id":2},
{"player_id":2,"device_id":3},
{"player_id":3,"device_id":1}
]For each player, keep the row with the earliest event_date and return that row's device_id.
Activity:
| player_id | device_id | event_date | games_played |
|-----------|-----------|-------------|--------------|
| 10 | 42 | 2022-09-05 | 0 |
| 10 | 7 | 2023-01-10 | 8 |
| 11 | 99 | 2021-12-31 | 3 |[
{"player_id":10,"device_id":42},
{"player_id":11,"device_id":99}
]Player 10 has multiple logins, but only the earliest date (2022-09-05) matters.
Activity:
| player_id | device_id | event_date | games_played |
|-----------|-----------|-------------|--------------|
| 4 | 12 | 2020-02-01 | 2 |
| 4 | 3 | 2021-01-01 | 9 |
| 5 | 4 | 2019-11-10 | 1 |
| 5 | 8 | 2020-01-09 | 4 |[
{"player_id":4,"device_id":12},
{"player_id":5,"device_id":4}
]Do not choose the smallest device_id. Choose the device from the earliest event_date per player.
Constraints