[LeetCode]620. Not Boring Movies

题目

X city opened a new cinema, many people would like to go to this cinema. The cinema also gives out a poster indicating the movies’ ratings and descriptions.

Please write a SQL query to output movies with an odd numbered ID and a description that is not 'boring'. Order the result by rating.

For example, table cinema:

+---------+-----------+--------------+-----------+
|   id    | movie     |  description |  rating   |
+---------+-----------+--------------+-----------+
|   1     | War       |   great 3D   |   8.9     |
|   2     | Science   |   fiction    |   8.5     |
|   3     | irish     |   boring     |   6.2     |
|   4     | Ice song  |   Fantacy    |   8.6     |
|   5     | House card|   Interesting|   9.1     |
+---------+-----------+--------------+-----------+

For the example above, the output should be:

+---------+-----------+--------------+-----------+
|   id    | movie     |  description |  rating   |
+---------+-----------+--------------+-----------+
|   5     | House card|   Interesting|   9.1     |
|   1     | War       |   great 3D   |   8.9     |
+---------+-----------+--------------+-----------+
难度

Easy

Sql
# Write your MySQL query statement below
select * from cinema where id%2 and description != 'boring' order by rating desc;
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 10,066评论 0 23
  • 这是开学前写的随笔。 开学的日期近了,作业没写完,该忘记的人没忘掉,还是碌碌无为,可能对于现在的我来说,只要好好地...
    不廿阅读 314评论 0 0
  • 今天做指甲的时候听到老板娘说的最对的一句话就是,只有自己喜欢的款式才可以保持的久。 所以为了保证那个款式是自己喜欢...
    强迫症的幸福指南阅读 535评论 0 50
  • 理论上说,学生是不该上补习班的。 中小学阶段,只要老师能较为正确的教学,学生能较为正常的完成学业,他已经合格了,他...
    yhj灵阅读 375评论 1 1
  • 这些天,不管是否愿意,估计所有人都主动或被动的看到过有关《战狼2》的讯息。尤其是它坐上了火箭一般的票房增长速度。 ...
    青禾花椒阅读 352评论 2 0