620. 有趣的电影(MySQL)(多条件查询+排序(没法union))
程序员文章站
2024-03-08 15:58:46
...
1 题目
2 MySQL
2.1 方法一(不等于,取模,排序)
select id, movie, description, rating
from cinema
where description <> 'boring'
and id % 2 = 1
order by rating desc;
写的不好
1 != 改用 <>
2 取模方法:& mod % (判断奇偶数才能用&;效率未知)
3 and 前应该放筛选快的条件
select id, movie, description, rating
from cinema
# where id % 2 = 1
# where mod(id, 2) = 1
where id & 1 = 1
and description <> 'boring'
order by rating desc;
上一篇: 深入研究Integer
下一篇: 初学Java整理第一天