We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 632ca3b + e051ba7 commit 1296cbbCopy full SHA for 1296cbb
LeetCode SQL 50 Solution/197. Rising Temperature/Rising Temperature.sql
@@ -0,0 +1,21 @@
1
+"""197. Rising Temperature"""
2
+
3
+WITH PreviousWeatherData AS
4
+(
5
+ SELECT
6
+ id,
7
+ recordDate,
8
+ temperature,
9
+ LAG(temperature, 1) OVER (ORDER BY recordDate) AS PreviousTemperature,
10
+ LAG(recordDate, 1) OVER (ORDER BY recordDate) AS PreviousRecordDate
11
+ FROM
12
+ Weather
13
+)
14
+SELECT
15
+ id
16
+FROM
17
+ PreviousWeatherData
18
+WHERE
19
+ temperature > PreviousTemperature
20
+AND
21
+ recordDate = DATE_ADD(PreviousRecordDate, INTERVAL 1 DAY);
0 commit comments