[LeetCode] Article Views I

아르당·2026년 4월 5일

LeetCode

목록 보기
243/263
post-thumbnail

문제를 이해하고 있다면 바로 풀이를 보면 됨
전체 코드로 바로 넘어가도 됨
마음대로 번역해서 오역이 있을 수 있음

Problem

Table: Views

Column NameType
article_idint
author_idint
viewer_idint
view_datedate

이 테이블에는 기본 키가 없고, 중복된 행이 있을 수 있다.
테이블의 각 행은 어떤 날짜의 기사를 본 어떤 뷰어를 나타낸다.

자신의 기사를 최소 한 개 이상 조회한 모든 뷰어를 찾는 방법을 작성해라.

Example

Input:
Views table:

article_idauthor_idviewer_idview_date
1352019-08-01
1362019-08-02
2772019-08-01
2762019-08-02
4712019-07-22
3442019-07-21
3442019-07-21

Output:

id
4
7

Solved

-- Write your PostgreSQL query statement below
select distinct author_id as id
from Views
where author_id = viewer_id
order by author_id asc;
profile
내 마음대로 코드 작성하는 세상

0개의 댓글