Skip to content

Commit dec4ad9

Browse files
refactor 197
1 parent b1605a2 commit dec4ad9

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed

database/_197.sql

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -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-
201
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

Comments
 (0)