LeetCode MySQL刷题——day2
生活随笔
收集整理的這篇文章主要介紹了
LeetCode MySQL刷题——day2
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
目錄
一、上升的溫度
1、題目描述
2、題解
?3、源碼
二、大的國家
1、題目描述
2、題解
??3、源碼
?三、超過五名學生的課
1、題目描述
2、題解?
3、源碼
?四、有趣的電影
1、題目描述
2、題解
3、源碼
?五、變更性別
1、題目描述
?2、題解
3、源碼
一、上升的溫度
1、題目描述
?
2、題解
?3、源碼
# Write your MySQL query statement below select e1.id from Weather as e1 inner join Weather as e2 on DATEDIFF(e1.recordDate,e2.recordDate) = 1 and e1.Temperature > e2.Temperature;二、大的國家
1、題目描述
?
2、題解
?3、源碼
# Write your MySQL query statement below select name,population,area from World where area >= 3000000 or population >= 25000000;?三、超過五名學生的課
1、題目描述
2、題解?
3、源碼
# Write your MySQL query statement below select class from courses GROUP BY class HAVING COUNT(student) >=5;# SELECT # class # FROM # (SELECT # class, COUNT(DISTINCT student) AS num # FROM # courses # GROUP BY class) AS temp_table # WHERE # num >= 5 # ;?四、有趣的電影
1、題目描述
?
2、題解
3、源碼
select id,movie,description,rating from cinema where mod(id,2) = 1 and description != 'boring' order by rating desc;?五、變更性別
1、題目描述
?
?2、題解
3、源碼
# Write your MySQL query statement below update Salary SETsex = CASE sexWHEN 'm' THEN 'f'ELSE 'm'END;?
總結
以上是生活随笔為你收集整理的LeetCode MySQL刷题——day2的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Python学习之函数返回多个值
- 下一篇: 禁止复制的网页怎么复制