bugfree Icon
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course

Leetcode Problem 197. Rising Temperature

197. Rising Temperature

Leetcode Solutions

Finding Dates with Higher Temperatures Compared to Previous Dates

  1. Perform a self-join on the Weather table, aliasing one instance as weather and the other as w.
  2. Use the DATEDIFF() function to find pairs of records where weather.recordDate is exactly one day after w.recordDate.
  3. Add a condition to the join to only include pairs where weather.temperature is greater than w.temperature.
  4. Select the id from the weather table for the rows that meet the above conditions.
  5. Return the result, which will be a list of id values corresponding to the dates with higher temperatures compared to the previous day.
erDiagram
    Weather {
        int id
        date recordDate
        int temperature
    }

Finding Dates with Higher Temperatures Using Subquery

Ask Question

Programming Language
image/screenshot of info(optional)
Full Screen
Loading...

Suggested Answer

Answer
Full Screen
Copy Answer Code
Loading...