Leetcode PHP题解--D27 620. Not Boring Movies

620. Not Boring Movies

题目链接

620. Not Boring Movies

题目分析

前面铺垫了那么多,要求就在这:

movies with an odd numbered ID and a description that is not 'boring'. Order the result by rating.

返回id为偶数、description不是boring的结果,并且按rating排序。

思路

返回偶数id的结果,这个比较简单,除以2去余就好了:id%2=1

description不能是boring,也很简单description not like 'boring'

根据rating排序:order by rating

最终代码

# Write your MySQL query statement below
SELECT * FROM cinema WHERE id%2=1 AND description NOT LIKE 'boring' ORDER BY rating DESC;

若觉得本文章对你有用,欢迎用爱发电资助。

skys215 has written 39 articles

没有bug的代码是有bug的代码。

积分:2152 等级:P7 职业:PHP工程师 城市:深圳

0 条回复

登录后才能进行评论,立即登录?