Snoopy [리트코드/SQL] 17. Article Views I (1148)
코딩테스트/리트코드 SQL

[리트코드/SQL] 17. Article Views I (1148)

Sooyoon Jeong 2022. 12. 18.

목차

👉 https://leetcode.com/problems/article-views-i/description/?envType=study-plan&id=sql-i

 

Article Views I - LeetCode

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview....

leetcode.com

 

🤔 문제 분석

1) Write an SQL query to find all the authors that viewed at least one of their own articles.

2) Return the result table sorted by id in ascending order.

 

💡 풀이

SELECT DISTINCT author_id as id 
FROM Views
WHERE author_id = viewer_id
ORDER BY id

 

댓글