mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 11:43:12 +08:00 
			
		
		
		
	国外版
This commit is contained in:
		
							
								
								
									
										47
									
								
								算法题(国外版)/rising-temperature.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								算法题(国外版)/rising-temperature.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,47 @@
 | 
			
		||||
<p>Table: <code>Weather</code></p>
 | 
			
		||||
 | 
			
		||||
<pre>
 | 
			
		||||
+---------------+---------+
 | 
			
		||||
| Column Name   | Type    |
 | 
			
		||||
+---------------+---------+
 | 
			
		||||
| id            | int     |
 | 
			
		||||
| recordDate    | date    |
 | 
			
		||||
| temperature   | int     |
 | 
			
		||||
+---------------+---------+
 | 
			
		||||
id is the primary key for this table.
 | 
			
		||||
This table contains information about the temperature on a certain day.
 | 
			
		||||
</pre>
 | 
			
		||||
 | 
			
		||||
<p> </p>
 | 
			
		||||
 | 
			
		||||
<p>Write an SQL query to find all dates' <code>Id</code> with higher temperatures compared to its previous dates (yesterday).</p>
 | 
			
		||||
 | 
			
		||||
<p>Return the result table in <strong>any order</strong>.</p>
 | 
			
		||||
 | 
			
		||||
<p>The query result format is in the following example.</p>
 | 
			
		||||
 | 
			
		||||
<p> </p>
 | 
			
		||||
<p><strong>Example 1:</strong></p>
 | 
			
		||||
 | 
			
		||||
<pre>
 | 
			
		||||
<strong>Input:</strong> 
 | 
			
		||||
Weather table:
 | 
			
		||||
+----+------------+-------------+
 | 
			
		||||
| id | recordDate | temperature |
 | 
			
		||||
+----+------------+-------------+
 | 
			
		||||
| 1  | 2015-01-01 | 10          |
 | 
			
		||||
| 2  | 2015-01-02 | 25          |
 | 
			
		||||
| 3  | 2015-01-03 | 20          |
 | 
			
		||||
| 4  | 2015-01-04 | 30          |
 | 
			
		||||
+----+------------+-------------+
 | 
			
		||||
<strong>Output:</strong> 
 | 
			
		||||
+----+
 | 
			
		||||
| id |
 | 
			
		||||
+----+
 | 
			
		||||
| 2  |
 | 
			
		||||
| 4  |
 | 
			
		||||
+----+
 | 
			
		||||
<strong>Explanation:</strong> 
 | 
			
		||||
In 2015-01-02, the temperature was higher than the previous day (10 -> 25).
 | 
			
		||||
In 2015-01-04, the temperature was higher than the previous day (20 -> 30).
 | 
			
		||||
</pre>
 | 
			
		||||
		Reference in New Issue
	
	Block a user