|
| 1 | +<h2><a href="https://leetcode.com/problems/game-play-analysis-i">Game Play Analysis I</a></h2> <img src='https://img.shields.io/badge/Difficulty-Easy-brightgreen' alt='Difficulty: Easy' /><hr><p>Table: <code>Activity</code></p> |
| 2 | + |
| 3 | +<pre> |
| 4 | ++--------------+---------+ |
| 5 | +| Column Name | Type | |
| 6 | ++--------------+---------+ |
| 7 | +| player_id | int | |
| 8 | +| device_id | int | |
| 9 | +| event_date | date | |
| 10 | +| games_played | int | |
| 11 | ++--------------+---------+ |
| 12 | +(player_id, event_date) is the primary key (combination of columns with unique values) of this table. |
| 13 | +This table shows the activity of players of some games. |
| 14 | +Each row is a record of a player who logged in and played a number of games (possibly 0) before logging out on someday using some device. |
| 15 | +</pre> |
| 16 | + |
| 17 | +<p> </p> |
| 18 | + |
| 19 | +<p>Write a solution to find the <strong>first login date</strong> for each player.</p> |
| 20 | + |
| 21 | +<p>Return the result table in <strong>any order</strong>.</p> |
| 22 | + |
| 23 | +<p>The result format is in the following example.</p> |
| 24 | + |
| 25 | +<p> </p> |
| 26 | +<p><strong class="example">Example 1:</strong></p> |
| 27 | + |
| 28 | +<pre> |
| 29 | +<strong>Input:</strong> |
| 30 | +Activity table: |
| 31 | ++-----------+-----------+------------+--------------+ |
| 32 | +| player_id | device_id | event_date | games_played | |
| 33 | ++-----------+-----------+------------+--------------+ |
| 34 | +| 1 | 2 | 2016-03-01 | 5 | |
| 35 | +| 1 | 2 | 2016-05-02 | 6 | |
| 36 | +| 2 | 3 | 2017-06-25 | 1 | |
| 37 | +| 3 | 1 | 2016-03-02 | 0 | |
| 38 | +| 3 | 4 | 2018-07-03 | 5 | |
| 39 | ++-----------+-----------+------------+--------------+ |
| 40 | +<strong>Output:</strong> |
| 41 | ++-----------+-------------+ |
| 42 | +| player_id | first_login | |
| 43 | ++-----------+-------------+ |
| 44 | +| 1 | 2016-03-01 | |
| 45 | +| 2 | 2017-06-25 | |
| 46 | +| 3 | 2016-03-02 | |
| 47 | ++-----------+-------------+ |
| 48 | +</pre> |
0 commit comments