{ "data": { "question": { "questionId": "197", "questionFrontendId": "197", "categoryTitle": "Database", "boundTopicId": 1287, "title": "Rising Temperature", "titleSlug": "rising-temperature", "content": "

Table: Weather

\n\n
\n+---------------+---------+\n| Column Name   | Type    |\n+---------------+---------+\n| id            | int     |\n| recordDate    | date    |\n| temperature   | int     |\n+---------------+---------+\nid is the primary key for this table.\nThis table contains information about the temperature on a certain day.\n
\n\n

 

\n\n

Write an SQL query to find all dates' Id with higher temperatures compared to its previous dates (yesterday).

\n\n

Return the result table in any order.

\n\n

The query result format is in the following example.

\n\n

 

\n

Example 1:

\n\n
\nInput: \nWeather table:\n+----+------------+-------------+\n| id | recordDate | temperature |\n+----+------------+-------------+\n| 1  | 2015-01-01 | 10          |\n| 2  | 2015-01-02 | 25          |\n| 3  | 2015-01-03 | 20          |\n| 4  | 2015-01-04 | 30          |\n+----+------------+-------------+\nOutput: \n+----+\n| id |\n+----+\n| 2  |\n| 4  |\n+----+\nExplanation: \nIn 2015-01-02, the temperature was higher than the previous day (10 -> 25).\nIn 2015-01-04, the temperature was higher than the previous day (20 -> 30).\n
\n", "translatedTitle": "上升的温度", "translatedContent": "
\n
\n

表: Weather

\n\n
\n+---------------+---------+\n| Column Name   | Type    |\n+---------------+---------+\n| id            | int     |\n| recordDate    | date    |\n| temperature   | int     |\n+---------------+---------+\nid 是这个表的主键\n该表包含特定日期的温度信息
\n\n

 

\n\n

编写一个 SQL 查询,来查找与之前(昨天的)日期相比温度更高的所有日期的 id

\n\n

返回结果 不要求顺序

\n\n

查询结果格式如下例。

\n\n

 

\n\n

示例 1:

\n\n
\n输入:\nWeather 表:\n+----+------------+-------------+\n| id | recordDate | Temperature |\n+----+------------+-------------+\n| 1  | 2015-01-01 | 10          |\n| 2  | 2015-01-02 | 25          |\n| 3  | 2015-01-03 | 20          |\n| 4  | 2015-01-04 | 30          |\n+----+------------+-------------+\n输出:\n+----+\n| id |\n+----+\n| 2  |\n| 4  |\n+----+\n解释:\n2015-01-02 的温度比前一天高(10 -> 25)\n2015-01-04 的温度比前一天高(20 -> 30)
\n
\n
\n", "isPaidOnly": false, "difficulty": "Easy", "likes": 284, "dislikes": 0, "isLiked": null, "similarQuestions": "[]", "contributors": [], "langToValidPlayground": "{\"cpp\": false, \"java\": false, \"python\": false, \"python3\": false, \"mysql\": false, \"mssql\": false, \"oraclesql\": false, \"c\": false, \"csharp\": false, \"javascript\": false, \"ruby\": false, \"bash\": false, \"swift\": false, \"golang\": false, \"scala\": false, \"html\": false, \"pythonml\": false, \"kotlin\": false, \"rust\": false, \"php\": false, \"typescript\": false, \"racket\": false, \"erlang\": false, \"elixir\": false}", "topicTags": [ { "name": "Database", "slug": "database", "translatedName": "数据库", "__typename": "TopicTagNode" } ], "companyTagStats": null, "codeSnippets": [ { "lang": "MySQL", "langSlug": "mysql", "code": "# Write your MySQL query statement below", "__typename": "CodeSnippetNode" }, { "lang": "MS SQL Server", "langSlug": "mssql", "code": "/* Write your T-SQL query statement below */", "__typename": "CodeSnippetNode" }, { "lang": "Oracle", "langSlug": "oraclesql", "code": "/* Write your PL/SQL query statement below */", "__typename": "CodeSnippetNode" } ], "stats": "{\"totalAccepted\": \"113.8K\", \"totalSubmission\": \"214K\", \"totalAcceptedRaw\": 113847, \"totalSubmissionRaw\": 214042, \"acRate\": \"53.2%\"}", "hints": [], "solution": { "id": "96", "canSeeDetail": true, "__typename": "ArticleNode" }, "status": null, "sampleTestCase": "{\"headers\": {\"Weather\": [\"id\", \"recordDate\", \"temperature\"]}, \"rows\": {\"Weather\": [[1, \"2015-01-01\", 10], [2, \"2015-01-02\", 25], [3, \"2015-01-03\", 20], [4, \"2015-01-04\", 30]]}}", "metaData": "{\n \"mysql\": [\n \"Create table If Not Exists Weather (id int, recordDate date, temperature int)\"\n ],\n \"mssql\": [\n \"Create table Weather (id int, recordDate date, temperature int)\"\n ],\n \"oraclesql\": [\n \"Create table Weather (id int, recordDate date, temperature int)\",\n \"ALTER SESSION SET nls_date_format='YYYY-MM-DD'\"\n ],\n \"database\": true\n}", "judgerAvailable": true, "judgeType": "large", "mysqlSchemas": [ "Create table If Not Exists Weather (id int, recordDate date, temperature int)", "Truncate table Weather", "insert into Weather (id, recordDate, temperature) values ('1', '2015-01-01', '10')", "insert into Weather (id, recordDate, temperature) values ('2', '2015-01-02', '25')", "insert into Weather (id, recordDate, temperature) values ('3', '2015-01-03', '20')", "insert into Weather (id, recordDate, temperature) values ('4', '2015-01-04', '30')" ], "enableRunCode": true, "envInfo": "{\"mysql\":[\"MySQL\",\"

\\u7248\\u672c\\uff1aMySQL 8.0<\\/code><\\/p>\"],\"mssql\":[\"MS SQL Server\",\"

mssql server 2019.<\\/p>\"],\"oraclesql\":[\"Oracle\",\"

Oracle Sql 11.2.<\\/p>\"]}", "book": null, "isSubscribed": false, "isDailyQuestion": false, "dailyRecordStatus": null, "editorType": "CKEDITOR", "ugcQuestionId": null, "style": "LEETCODE", "exampleTestcases": "{\"headers\": {\"Weather\": [\"id\", \"recordDate\", \"temperature\"]}, \"rows\": {\"Weather\": [[1, \"2015-01-01\", 10], [2, \"2015-01-02\", 25], [3, \"2015-01-03\", 20], [4, \"2015-01-04\", 30]]}}", "__typename": "QuestionNode" } } }