Fetch the repository succeeded.
{
"data": {
"question": {
"questionId": "1258",
"questionFrontendId": "1148",
"boundTopicId": null,
"title": "Article Views I",
"titleSlug": "article-views-i",
"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> </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> </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",
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 1114,
"dislikes": 56,
"isLiked": null,
"similarQuestions": "[]",
"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\"]]}}",
"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"
},
{
"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\n",
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"339.5K\", \"totalSubmission\": \"458.4K\", \"totalAcceptedRaw\": 339534, \"totalSubmissionRaw\": 458395, \"acRate\": \"74.1%\"}",
"hints": [],
"solution": {
"id": "2026",
"canSeeDetail": false,
"paidOnly": true,
"hasVideoSolution": false,
"paidOnlyVideo": true,
"__typename": "ArticleNode"
},
"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\"]]}}",
"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\"}}}",
"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,
"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>\"], \"pythondata\": [\"Pandas\", \"<p>Python 3.10 with Pandas 2.0.2 and NumPy 1.25.0</p>\"], \"postgresql\": [\"PostgreSQL\", \"<p>PostgreSQL 16</p>\"]}",
"libraryUrl": null,
"adminUrl": null,
"challengeQuestion": null,
"__typename": "QuestionNode"
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。