2022-03-27 20:37:52 +08:00
{
"data" : {
"question" : {
"questionId" : "1179" ,
"questionFrontendId" : "511" ,
"categoryTitle" : "Database" ,
"boundTopicId" : 10991 ,
"title" : "Game Play Analysis I" ,
"titleSlug" : "game-play-analysis-i" ,
2023-12-09 18:42:21 +08:00
"content" : "<p>Table: <code>Activity</code></p>\n\n<pre>\n+--------------+---------+\n| Column Name | Type |\n+--------------+---------+\n| player_id | int |\n| device_id | int |\n| event_date | date |\n| games_played | int |\n+--------------+---------+\n(player_id, event_date) is the primary key (combination of columns with unique values) of this table.\nThis table shows the activity of players of some games.\nEach 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.\n</pre>\n\n<p> </p>\n\n<p>Write a solution to find the <strong>first login date</strong> for each player.</p>\n\n<p>Return the result table in <strong>any order</strong>.</p>\n\n<p>The result format is in the following example.</p>\n\n<p> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> \nActivity table:\n+-----------+-----------+------------+--------------+\n| player_id | device_id | event_date | games_played |\n+-----------+-----------+------------+--------------+\n| 1 | 2 | 2016-03-01 | 5 |\n| 1 | 2 | 2016-05-02 | 6 |\n| 2 | 3 | 2017-06-25 | 1 |\n| 3 | 1 | 2016-03-02 | 0 |\n| 3 | 4 | 2018-07-03 | 5 |\n+-----------+-----------+------------+--------------+\n<strong>Output:</strong> \n+-----------+-------------+\n| player_id | first_login |\n+-----------+-------------+\n| 1 | 2016-03-01 |\n| 2 | 2017-06-25 |\n| 3 | 2016-03-02 |\n+-----------+-------------+\n</pre>\n" ,
2022-03-27 20:37:52 +08:00
"translatedTitle" : "游戏玩法分析 I" ,
2023-12-09 18:42:21 +08:00
"translatedContent" : "<p>活动表 <code>Activity</code>: </p>\n\n<pre>\n+--------------+---------+\n| Column Name | Type |\n+--------------+---------+\n| player_id | int |\n| device_id | int |\n| event_date | date |\n| games_played | int |\n+--------------+---------+\n在 SQL 中,表的主键是 (player_id, event_date)。\n这张表展示了一些游戏玩家在游戏平台上的行为活动。\n每行数据记录了一名玩家在退出平台之前, 当天使用同一台设备登录平台后打开的游戏的数目( 可能是 0 个)。\n</pre>\n\n<p> </p>\n\n<p>查询每位玩家 <strong>第一次登陆平台的日期</strong>。</p>\n\n<p>查询结果的格式如下所示:</p>\n\n<pre>\nActivity 表:\n+-----------+-----------+------------+--------------+\n| player_id | device_id | event_date | games_played |\n+-----------+-----------+------------+--------------+\n| 1 | 2 | 2016-03-01 | 5 |\n| 1 | 2 | 2016-05-02 | 6 |\n| 2 | 3 | 2017-06-25 | 1 |\n| 3 | 1 | 2016-03-02 | 0 |\n| 3 | 4 | 2018-07-03 | 5 |\n+-----------+-----------+------------+--------------+\n\nResult 表:\n+-----------+-------------+\n| player_id | first_login |\n+-----------+-------------+\n| 1 | 2016-03-01 |\n| 2 | 2017-06-25 |\n| 3 | 2016-03-02 |\n+-----------+-------------+\n</pre>\n" ,
2022-03-27 20:37:52 +08:00
"isPaidOnly" : false ,
"difficulty" : "Easy" ,
2023-12-09 18:42:21 +08:00
"likes" : 136 ,
2022-03-27 20:37:52 +08:00
"dislikes" : 0 ,
"isLiked" : null ,
2023-12-09 18:42:21 +08:00
"similarQuestions" : "[{\"title\": \"Game Play Analysis II\", \"titleSlug\": \"game-play-analysis-ii\", \"difficulty\": \"Easy\", \"translatedTitle\": \"\\u6e38\\u620f\\u73a9\\u6cd5\\u5206\\u6790 II\", \"isPaidOnly\": true}]" ,
2022-03-27 20:37:52 +08:00
"contributors" : [ ] ,
2023-12-09 18:42:21 +08:00
"langToValidPlayground" : "{\"cpp\": false, \"java\": false, \"python\": false, \"python3\": false, \"mysql\": false, \"mssql\": false, \"oraclesql\": false, \"c\": false, \"csharp\": false, \"javascript\": false, \"typescript\": false, \"bash\": false, \"php\": false, \"swift\": false, \"kotlin\": false, \"dart\": false, \"golang\": false, \"ruby\": false, \"scala\": false, \"html\": false, \"pythonml\": false, \"rust\": false, \"racket\": false, \"erlang\": false, \"elixir\": false, \"pythondata\": false, \"react\": false, \"vanillajs\": false, \"postgresql\": false}" ,
2022-03-27 20:37:52 +08:00
"topicTags" : [
{
"name" : "Database" ,
"slug" : "database" ,
"translatedName" : "数据库" ,
"__typename" : "TopicTagNode"
}
] ,
"companyTagStats" : null ,
"codeSnippets" : [
{
"lang" : "MySQL" ,
"langSlug" : "mysql" ,
"code" : "# Write your MySQL query statement below" ,
"__typename" : "CodeSnippetNode"
} ,
{
"lang" : "MS SQL Server" ,
"langSlug" : "mssql" ,
"code" : "/* Write your T-SQL query statement below */" ,
"__typename" : "CodeSnippetNode"
} ,
{
"lang" : "Oracle" ,
"langSlug" : "oraclesql" ,
"code" : "/* Write your PL/SQL query statement below */" ,
"__typename" : "CodeSnippetNode"
2023-12-09 18:42:21 +08:00
} ,
{
"lang" : "Pandas" ,
"langSlug" : "pythondata" ,
"code" : "import pandas as pd\n\ndef game_analysis(activity: pd.DataFrame) -> pd.DataFrame:\n " ,
"__typename" : "CodeSnippetNode"
} ,
{
"lang" : "PostgreSQL" ,
"langSlug" : "postgresql" ,
"code" : "-- Write your PostgreSQL query statement below" ,
"__typename" : "CodeSnippetNode"
2022-03-27 20:37:52 +08:00
}
] ,
2023-12-09 18:42:21 +08:00
"stats" : "{\"totalAccepted\": \"105.6K\", \"totalSubmission\": \"149.3K\", \"totalAcceptedRaw\": 105572, \"totalSubmissionRaw\": 149309, \"acRate\": \"70.7%\"}" ,
2022-03-27 20:37:52 +08:00
"hints" : [ ] ,
"solution" : null ,
"status" : null ,
"sampleTestCase" : "{\"headers\":{\"Activity\":[\"player_id\",\"device_id\",\"event_date\",\"games_played\"]},\"rows\":{\"Activity\":[[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]]}}" ,
2023-12-09 18:42:21 +08:00
"metaData" : "{\"mysql\":[\"Create table If Not Exists Activity (player_id int, device_id int, event_date date, games_played int)\"],\"mssql\":[\"Create table Activity (player_id int, device_id int, event_date date, games_played int)\"],\"oraclesql\":[\"Create table Activity (player_id int, device_id int, event_date date, games_played int)\",\"ALTER SESSION SET nls_date_format='YYYY-MM-DD'\"],\"database\":true,\"name\":\"game_analysis\",\"pythondata\":[\"Activity = pd.DataFrame([], columns=['player_id', 'device_id', 'event_date', 'games_played']).astype({'player_id':'Int64', 'device_id':'Int64', 'event_date':'datetime64[ns]', 'games_played':'Int64'})\"],\"manual\":false,\"postgresql\":[\"Create table If Not Exists Activity (player_id int, device_id int, event_date date, games_played int)\"],\"database_schema\":{\"Activity\":{\"player_id\":\"INT\",\"device_id\":\"INT\",\"event_date\":\"DATE\",\"games_played\":\"INT\"}}}" ,
2022-03-27 20:37:52 +08:00
"judgerAvailable" : true ,
"judgeType" : "large" ,
"mysqlSchemas" : [
"Create table If Not Exists Activity (player_id int, device_id int, event_date date, games_played int)" ,
"Truncate table Activity" ,
"insert into Activity (player_id, device_id, event_date, games_played) values ('1', '2', '2016-03-01', '5')" ,
"insert into Activity (player_id, device_id, event_date, games_played) values ('1', '2', '2016-05-02', '6')" ,
"insert into Activity (player_id, device_id, event_date, games_played) values ('2', '3', '2017-06-25', '1')" ,
"insert into Activity (player_id, device_id, event_date, games_played) values ('3', '1', '2016-03-02', '0')" ,
"insert into Activity (player_id, device_id, event_date, games_played) values ('3', '4', '2018-07-03', '5')"
] ,
"enableRunCode" : true ,
2023-12-09 18:42:21 +08:00
"envInfo" : "{\"mysql\":[\"MySQL\",\"<p>\\u7248\\u672c\\uff1a<code>MySQL 8.0<\\/code><\\/p>\"],\"mssql\":[\"MS SQL Server\",\"<p>mssql server 2019.<\\/p>\"],\"oraclesql\":[\"Oracle\",\"<p>Oracle Sql 11.2.<\\/p>\"],\"pythondata\":[\"Pandas\",\"<p>Python 3.10 with Pandas 2.0.2 and NumPy 1.25.0<\\/p>\"],\"postgresql\":[\"PostgreSQL\",\"<p>PostgreSQL 16<\\/p>\"]}" ,
2022-03-27 20:37:52 +08:00
"book" : null ,
"isSubscribed" : false ,
"isDailyQuestion" : false ,
"dailyRecordStatus" : null ,
"editorType" : "CKEDITOR" ,
"ugcQuestionId" : null ,
"style" : "LEETCODE" ,
"exampleTestcases" : "{\"headers\":{\"Activity\":[\"player_id\",\"device_id\",\"event_date\",\"games_played\"]},\"rows\":{\"Activity\":[[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]]}}" ,
"__typename" : "QuestionNode"
}
}
}