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.
1 parent b1605a2 commit dec4ad9Copy full SHA for dec4ad9
database/_197.sql
@@ -1,20 +1 @@
1
--- Given a Weather table, write a SQL query to find all dates' Ids with higher temperature compared to its previous (yesterday's) dates.
2
---
3
--- +---------+------------+------------------+
4
--- | Id(INT) | Date(DATE) | Temperature(INT) |
5
6
--- | 1 | 2015-01-01 | 10 |
7
--- | 2 | 2015-01-02 | 25 |
8
--- | 3 | 2015-01-03 | 20 |
9
--- | 4 | 2015-01-04 | 30 |
10
11
--- For example, return the following Ids for the above Weather table:
12
--- +----+
13
--- | Id |
14
15
--- | 2 |
16
--- | 4 |
17
18
-
19
20
select w1.Id from Weather w1, Weather w2 where w1.Temperature > w2.Temperature and to_days(w1.Date) - to_days(w2.date) = 1;
0 commit comments