🤔 문제 분석
1) Write an SQL query to find all dates' Id with higher temperatures compared to its previous dates (yesterday).
2) Return the result table in any order.
💡 풀이
SELECT b.id AS Id
FROM Weather AS a
join Weather AS b ON DATEDIFF(b.recordDate, a.recordDate) = 1
WHERE b.temperature > a.temperature
'코딩테스트 > 리트코드 SQL' 카테고리의 다른 글
[리트코드/SQL] 20. User Activity for the Past 30 Days I (1141) (0) | 2022.12.18 |
---|---|
[리트코드/SQL] 19. Sales Person (607) (0) | 2022.12.18 |
[리트코드/SQL] 17. Article Views I (1148) (0) | 2022.12.18 |
[리트코드/SQL] 16. Customer Who Visited but Did Not Make Any Transactions (1581) (0) | 2022.12.18 |
[리트코드/SQL] 15. Combine Two Tables (175) (0) | 2022.12.18 |
댓글