1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/originData/article-views-i.json

94 lines
9.3 KiB
JSON
Raw Normal View History

2022-03-27 20:37:52 +08:00
{
"data": {
"question": {
"questionId": "1258",
"questionFrontendId": "1148",
"categoryTitle": "Database",
"boundTopicId": 33166,
"title": "Article Views I",
"titleSlug": "article-views-i",
2023-12-09 18:42:21 +08:00
"content": "<p>Table: <code>Views</code></p>\n\n<pre>\n+---------------+---------+\n| Column Name | Type |\n+---------------+---------+\n| article_id | int |\n| author_id | int |\n| viewer_id | int |\n| view_date | date |\n+---------------+---------+\nThere is no primary key (column with unique values) for this table, the table may have duplicate rows.\nEach row of this table indicates that some viewer viewed an article (written by some author) on some date. \nNote that equal author_id and viewer_id indicate the same person.\n</pre>\n\n<p>&nbsp;</p>\n\n<p>Write a solution to find all the authors that viewed at least one of their own articles.</p>\n\n<p>Return the result table sorted by <code>id</code> in ascending order.</p>\n\n<p>The result format is in the following example.</p>\n\n<p>&nbsp;</p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> \nViews table:\n+------------+-----------+-----------+------------+\n| article_id | author_id | viewer_id | view_date |\n+------------+-----------+-----------+------------+\n| 1 | 3 | 5 | 2019-08-01 |\n| 1 | 3 | 6 | 2019-08-02 |\n| 2 | 7 | 7 | 2019-08-01 |\n| 2 | 7 | 6 | 2019-08-02 |\n| 4 | 7 | 1 | 2019-07-22 |\n| 3 | 4 | 4 | 2019-07-21 |\n| 3 | 4 | 4 | 2019-07-21 |\n+------------+-----------+-----------+------------+\n<strong>Output:</strong> \n+------+\n| id |\n+------+\n| 4 |\n| 7 |\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>Views</code>&nbsp;表:</p>\n\n<pre>\n+---------------+---------+\n| Column Name | Type |\n+---------------+---------+\n| article_id | int |\n| author_id | int |\n| viewer_id | int |\n| view_date | date |\n+---------------+---------+\n此表可能会存在重复行。换句话说在 SQL 中这个表没有主键)\n此表的每一行都表示某人在某天浏览了某位作者的某篇文章。\n请注意同一人的 author_id 和 viewer_id 是相同的。\n</pre>\n\n<p>&nbsp;</p>\n\n<p>请查询出所有浏览过自己文章的作者</p>\n\n<p>结果按照 <code>id</code> 升序排列。</p>\n\n<p>查询结果的格式如下所示:</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>\nViews 表:\n+------------+-----------+-----------+------------+\n| article_id | author_id | viewer_id | view_date |\n+------------+-----------+-----------+------------+\n| 1 | 3 | 5 | 2019-08-01 |\n| 1 | 3 | 6 | 2019-08-02 |\n| 2 | 7 | 7 | 2019-08-01 |\n| 2 | 7 | 6 | 2019-08-02 |\n| 4 | 7 | 1 | 2019-07-22 |\n| 3 | 4 | 4 | 2019-07-21 |\n| 3 | 4 | 4 | 2019-07-21 |\n+------------+-----------+-----------+------------+\n\n<strong>输出:</strong>\n+------+\n| id |\n+------+\n| 4 |\n| 7 |\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": 100,
2022-03-27 20:37:52 +08:00
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
"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 article_views(views: 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\": \"84.1K\", \"totalSubmission\": \"119.4K\", \"totalAcceptedRaw\": 84056, \"totalSubmissionRaw\": 119389, \"acRate\": \"70.4%\"}",
2022-03-27 20:37:52 +08:00
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "{\"headers\":{\"Views\":[\"article_id\",\"author_id\",\"viewer_id\",\"view_date\"]},\"rows\":{\"Views\":[[1,3,5,\"2019-08-01\"],[1,3,6,\"2019-08-02\"],[2,7,7,\"2019-08-01\"],[2,7,6,\"2019-08-02\"],[4,7,1,\"2019-07-22\"],[3,4,4,\"2019-07-21\"],[3,4,4,\"2019-07-21\"]]}}",
2023-12-09 18:42:21 +08:00
"metaData": "{\"mysql\":[\"Create table If Not Exists Views (article_id int, author_id int, viewer_id int, view_date date)\"],\"mssql\":[\"Create table Views (article_id int, author_id int, viewer_id int, view_date date)\"],\"oraclesql\":[\"Create table Views (article_id int, author_id int, viewer_id int, view_date date)\",\"ALTER SESSION SET nls_date_format='YYYY-MM-DD'\"],\"database\":true,\"name\":\"article_views\",\"pythondata\":[\"Views = pd.DataFrame([], columns=['article_id', 'author_id', 'viewer_id', 'view_date']).astype({'article_id':'Int64', 'author_id':'Int64', 'viewer_id':'Int64', 'view_date':'datetime64[ns]'})\"],\"postgresql\":[\"Create table If Not Exists Views (article_id int, author_id int, viewer_id int, view_date date)\"],\"database_schema\":{\"Views\":{\"article_id\":\"INT\",\"author_id\":\"INT\",\"viewer_id\":\"INT\",\"view_date\":\"DATE\"}}}",
2022-03-27 20:37:52 +08:00
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
"Create table If Not Exists Views (article_id int, author_id int, viewer_id int, view_date date)",
"Truncate table Views",
"insert into Views (article_id, author_id, viewer_id, view_date) values ('1', '3', '5', '2019-08-01')",
"insert into Views (article_id, author_id, viewer_id, view_date) values ('1', '3', '6', '2019-08-02')",
"insert into Views (article_id, author_id, viewer_id, view_date) values ('2', '7', '7', '2019-08-01')",
"insert into Views (article_id, author_id, viewer_id, view_date) values ('2', '7', '6', '2019-08-02')",
"insert into Views (article_id, author_id, viewer_id, view_date) values ('4', '7', '1', '2019-07-22')",
"insert into Views (article_id, author_id, viewer_id, view_date) values ('3', '4', '4', '2019-07-21')",
"insert into Views (article_id, author_id, viewer_id, view_date) values ('3', '4', '4', '2019-07-21')"
],
"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\":{\"Views\":[\"article_id\",\"author_id\",\"viewer_id\",\"view_date\"]},\"rows\":{\"Views\":[[1,3,5,\"2019-08-01\"],[1,3,6,\"2019-08-02\"],[2,7,7,\"2019-08-01\"],[2,7,6,\"2019-08-02\"],[4,7,1,\"2019-07-22\"],[3,4,4,\"2019-07-21\"],[3,4,4,\"2019-07-21\"]]}}",
"__typename": "QuestionNode"
}
}
}