문제 - Article Views I
https://leetcode.com/problems/article-views-i/
Find all the authors that viewed at least one of their own articles.
Return the result table sorted by id in ascending order.
작성 답안
select distinct v.author_id as id
from views as v
where v.viewer_id = v.author_id
order by v.author_id asc
리뷰
- 쿼리 실행 순서
from -> where -> groupby -> having -> order by -> select
(groupby 이후 조건문은 having 으로 설정)
'SQL' 카테고리의 다른 글
[leetCode] # 1378 (0) | 2023.08.01 |
---|---|
[leetCode] #1683 (length와 char_length의 차이) (0) | 2023.07.31 |
[leetCode] # 584, 595, 1757 (coalesce를 통한 null 대체) (0) | 2023.07.18 |
[SQL | ORACLE] ORA-011033, ORA 01031 오류 해결 (2) | 2021.05.16 |
[SQL | ORACLE] - 비교, 관계 연산자 (1) | 2021.05.12 |