目录
一、上升的温度
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
SET
sex = CASE sex
WHEN 'm' THEN 'f'
ELSE 'm'
END;