From 8d342286ce0ce38f46957d8a9c9e358602dabadc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Antonio=20Chac=C3=B3n=20Guti=C3=A9rrez?= <138903866+joseantoniochacon@users.noreply.github.com> Date: Thu, 30 May 2024 20:14:00 -0600 Subject: [PATCH] Create README - LeetHub --- 1148-article-views-i/README.md | 48 ++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 1148-article-views-i/README.md diff --git a/1148-article-views-i/README.md b/1148-article-views-i/README.md new file mode 100644 index 0000000..fa2d760 --- /dev/null +++ b/1148-article-views-i/README.md @@ -0,0 +1,48 @@ +
Table: Views
+---------------+---------+ +| 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. ++ +
+ +
Write a solution to find all the authors that viewed at least one of their own articles.
+ +Return the result table sorted by id
in ascending order.
The result format is in the following example.
+ ++
Example 1:
+ +Input: +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 | ++------------+-----------+-----------+------------+ +Output: ++------+ +| id | ++------+ +| 4 | +| 7 | ++------+ ++