Article Views I
<p>Table: <code>Views</code></p>

<pre>
+---------------+---------+
| Column Name   | Type    |
+---------------+---------+
| article_id    | int     |
| author_id     | int     |
| viewer_id     | int     |
| view_date     | date    |
+---------------+---------+
There is no primary key (column with unique values) for this table, the table may have duplicate rows.
Each row of this table indicates that some viewer viewed an article (written by some author) on some date. 
Note that equal author_id and viewer_id indicate the same person.
</pre>

<p>&nbsp;</p>

<p>Write a solution to find all the authors that viewed at least one of their own articles.</p>

<p>Return the result table sorted by <code>id</code> in ascending order.</p>

<p>The result format is in the following example.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<pre>
<strong>Input:</strong> 
Views table:
+------------+-----------+-----------+------------+
| article_id | author_id | viewer_id | view_date  |
+------------+-----------+-----------+------------+
| 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 |
+------------+-----------+-----------+------------+
<strong>Output:</strong> 
+------+
| id   |
+------+
| 4    |
| 7    |
+------+
</pre>

[]
['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')"]
[{"value": "mysql", "text": "MySQL", "defaultCode": "# Write your MySQL query statement below\n"}, {"value": "mssql", "text": "MS SQL Server", "defaultCode": "/* Write your T-SQL query statement below */\n"}, {"value": "oraclesql", "text": "Oracle", "defaultCode": "/* Write your PL/SQL query statement below */\n"}, {"value": "pythondata", "text": "Pandas", "defaultCode": "import pandas as pd\n\ndef article_views(views: pd.DataFrame) -> pd.DataFrame:\n    "}, {"value": "postgresql", "text": "PostgreSQL", "defaultCode": "-- Write your PostgreSQL query statement below\n"}]
{"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"}}}
{"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.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16</p>"]}
['Database']