Fix Names in a Table
透過leetcode 197
Rising Temperature來練習
Learn More →
id 是該表的主鍵。
此表包含有關某一天的溫度的信息。
編寫 SQL 查詢以查找與之前日期(昨天)相比溫度較高的所有日期。order by Id
按任意順序返回結果表。
查詢結果格式位於以下範例中。
Learn More →
以下圖解為第一個例題
使用datediff來解題
datediff函數可以算出輸入的日期相隔天數
select T.id
from Weather T, Weather Y
where datediff(day, T.recordDate, Y.recordDate) = -1
and T.temperature > Y.temperature;
Learn More →
以下圖解為第二個例題(失敗)
SELECT M.id FROM Table_2 M
inner join Table_2 A on
cast(convert(varchar(10),A.recordDate,112) as int) + 1 = cast(convert(varchar(10),M.recordDate,112) as int)
where M.temperature > A.temperature
By. @UEW2WaUHTqSmPOSfnfXrNw
最小生成樹(Minimum Spanning Tree,MST)是指在一個帶權無向圖中,找到一棵包含所有節點,權值最小的樹。其中,權值是指樹中所有邊權重的總和。
May 9, 2025運算式(Expression)有三種表示方式:中序式(Infix)、前序式(Prefix)、後序式(Postfix)
Dec 27, 2024Pinia簡介
Dec 26, 2024氣泡排序是反覆進行將相鄰數字做比較後重新排序,因排序時一個一個浮出序列頂部,很像水中泡泡浮起來的樣子,亦稱泡泡排序,最壞情況下,數是由大排到小,每次比較後將數值對調,因此,時間複雜度為O(n^2)。
Dec 24, 2024or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up