SELECTdistinct c1.seat_id
FROM Cinema c1
INNERJOIN Cinema c2
ON c1.free=1AND c2.free=1AND abs(c1.seat_id-c2.seat_id)=1ORDERBY c1.seat_id asc
1.3 运行截图
2 不同国家的天气类型
2.1 题目内容
2.1.1 基本题目信息
2.1.2 示例输入输出
a 示例输入
b 示例输出
2.2 示例sql语句
#无需包含匹配不上的就用inner join# 我个人觉得先把有效数据筛选出来再去连接比较好#IF函数做多层嵌套时候,内层的IF函数条件需要加个括号SELECT c.country_name,IF(AVG(w.weather_state)<=15,'Cold',IF((AVG(w.weather_state)>=25),'Hot','Warm')) weather_type
FROM Countries c
INNERJOIN(SELECT country_id,weather_state,dayFROM Weather
WHERE date_format(day,"%Y-%m")='2019-11')w
ON c.country_id=w.country_id
GROUPBY c.country_name