Skip to content

Commit 36ff44f

Browse files
refactor 512
1 parent 2f31dbf commit 36ff44f

File tree

1 file changed

+0
-42
lines changed

1 file changed

+0
-42
lines changed

database/_512.sql

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,3 @@
1-
--512. Game Play Analysis II
2-
--
3-
--Table: Activity
4-
--
5-
--+--------------+---------+
6-
--| Column Name | Type |
7-
--+--------------+---------+
8-
--| player_id | int |
9-
--| device_id | int |
10-
--| event_date | date |
11-
--| games_played | int |
12-
--+--------------+---------+
13-
--(player_id, event_date) is the primary key of this table.
14-
--This table shows the activity of players of some game.
15-
--Each row is a record of a player who logged in and played a number of games (possibly 0) before logging out on some day using some device.
16-
--
17-
--
18-
--Write a SQL query that reports the device that is first logged in for each player.
19-
--
20-
--The query result format is in the following example:
21-
--
22-
--Activity table:
23-
--+-----------+-----------+------------+--------------+
24-
--| player_id | device_id | event_date | games_played |
25-
--+-----------+-----------+------------+--------------+
26-
--| 1 | 2 | 2016-03-01 | 5 |
27-
--| 1 | 2 | 2016-05-02 | 6 |
28-
--| 2 | 3 | 2017-06-25 | 1 |
29-
--| 3 | 1 | 2016-03-02 | 0 |
30-
--| 3 | 4 | 2018-07-03 | 5 |
31-
--+-----------+-----------+------------+--------------+
32-
--
33-
--Result table:
34-
--+-----------+-----------+
35-
--| player_id | device_id |
36-
--+-----------+-----------+
37-
--| 1 | 2 |
38-
--| 2 | 3 |
39-
--| 3 | 1 |
40-
--+-----------+-----------+
41-
42-
--# Write your MySQL query statement below
431
select player_id, device_id from Activity where
442
(player_id, event_date)
453
in

0 commit comments

Comments
 (0)