mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 02:58:13 +08:00
77 lines
6.0 KiB
JSON
77 lines
6.0 KiB
JSON
{
|
|
"data": {
|
|
"question": {
|
|
"questionId": "1179",
|
|
"questionFrontendId": "511",
|
|
"boundTopicId": null,
|
|
"title": "Game Play Analysis I",
|
|
"titleSlug": "game-play-analysis-i",
|
|
"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 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 an SQL query to report 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 query result format is in the following example.</p>\n\n<p> </p>\n<p><strong>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",
|
|
"translatedTitle": null,
|
|
"translatedContent": null,
|
|
"isPaidOnly": false,
|
|
"difficulty": "Easy",
|
|
"likes": 171,
|
|
"dislikes": 9,
|
|
"isLiked": null,
|
|
"similarQuestions": "[{\"title\": \"Game Play Analysis II\", \"titleSlug\": \"game-play-analysis-ii\", \"difficulty\": \"Easy\", \"translatedTitle\": null}]",
|
|
"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]]}}",
|
|
"categoryTitle": "Database",
|
|
"contributors": [],
|
|
"topicTags": [
|
|
{
|
|
"name": "Database",
|
|
"slug": "database",
|
|
"translatedName": null,
|
|
"__typename": "TopicTagNode"
|
|
}
|
|
],
|
|
"companyTagStats": null,
|
|
"codeSnippets": [
|
|
{
|
|
"lang": "MySQL",
|
|
"langSlug": "mysql",
|
|
"code": "# Write your MySQL query statement below\n",
|
|
"__typename": "CodeSnippetNode"
|
|
},
|
|
{
|
|
"lang": "MS SQL Server",
|
|
"langSlug": "mssql",
|
|
"code": "/* Write your T-SQL query statement below */\n",
|
|
"__typename": "CodeSnippetNode"
|
|
},
|
|
{
|
|
"lang": "Oracle",
|
|
"langSlug": "oraclesql",
|
|
"code": "/* Write your PL/SQL query statement below */\n",
|
|
"__typename": "CodeSnippetNode"
|
|
}
|
|
],
|
|
"stats": "{\"totalAccepted\": \"64K\", \"totalSubmission\": \"79.6K\", \"totalAcceptedRaw\": 64050, \"totalSubmissionRaw\": 79582, \"acRate\": \"80.5%\"}",
|
|
"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]]}}",
|
|
"metaData": "{\n \"mysql\": [\n \"Create table If Not Exists Activity (player_id int, device_id int, event_date date, games_played int)\"\n ],\n \"mssql\": [\n \"Create table Activity (player_id int, device_id int, event_date date, games_played int)\"\n ],\n \"oraclesql\": [\n \"Create table Activity (player_id int, device_id int, event_date date, games_played int)\",\n \"ALTER SESSION SET nls_date_format='YYYY-MM-DD'\"\n ],\n \"database\": true\n}",
|
|
"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,
|
|
"enableTestMode": false,
|
|
"enableDebugger": false,
|
|
"envInfo": "{\"mysql\": [\"MySQL\", \"<p><code>MySQL 8.0</code>.</p>\"], \"mssql\": [\"MS SQL Server\", \"<p><code>mssql server 2019</code>.</p>\"], \"oraclesql\": [\"Oracle\", \"<p><code>Oracle Sql 11.2</code>.</p>\"]}",
|
|
"libraryUrl": null,
|
|
"adminUrl": null,
|
|
"challengeQuestion": null,
|
|
"__typename": "QuestionNode"
|
|
}
|
|
}
|
|
} |