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 |
+---------+-----------+--------------+-----------+

Code

SELECT id, movie, description, rating FROM cinema WHERE mod(id,2) != 0 AND description != 'boring' ORDER BY rating DESC

[LeetCode] 620. Not Boring Movies_Easy tag: SQL的更多相关文章

  1. 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 ...

  2. leetcode 620. Not Boring Movies 用where语句判断

    https://leetcode.com/problems/not-boring-movies/description/ 不管题目简不简单,现在先熟悉语法. 直接用where语句判断即可,判断奇偶可以 ...

  3. LeetCode: 620 Not Boring Movies(easy)

    题目: X city opened a new cinema, many people would like to go to this cinema. The cinema also gives o ...

  4. LeetCode 620. Not Boring Movies (有趣的电影)

    题目标签: 题目给了我们一个 cinema 表格, 让我们找出 不无聊的电影,并且id 是奇数的,降序排列. 比较直接简单的,具体看code. Java Solution: Runtime:  149 ...

  5. [LeetCode] 619. Biggest Single Number_Easy tag: SQL

    Table number contains many numbers in column num including duplicated ones.Can you write a SQL query ...

  6. [LeetCode] 176. Second Highest Salary_Easy tag: SQL

    Write a SQL query to get the second highest salary from the Employee table. +----+--------+ | Id | S ...

  7. [LeetCode] 196. Delete Duplicate Emails_Easy tag: SQL

    Write a SQL query to delete all duplicate email entries in a table named Person, keeping only unique ...

  8. [LeetCode] 584. Find Customer Referee_Easy tag: SQL

    Given a table customer holding customers information and the referee. +------+------+-----------+ | ...

  9. [LeetCode] 603. Consecutive Available Seats_Easy tag: SQL

    Several friends at a cinema ticket office would like to reserve consecutive available seats.Can you ...

随机推荐

  1. STL之vector,deque学习实例

    ``` #include<iostream> #include<algorithm> #include<ctime> #include<vector> ...

  2. 极验(geetest)验证码

    最近在做项目的时候,需要用到登录验证,在网上看到了一个很不错的验证插件,在此记录一下使用流程. 极限验证码   官网:http://www.geetest.com/,到GitHub下载服务端代码htt ...

  3. python中的str和repr函数的区别

    看了一些网上的解释,最主流的解释是“str是给人看的,repr是给机器看的”,如果已经理解了的,这句话是对的,但是是有问题的,对于没懂的,这句话是无法理解的. 我来尝试解释一下.先直译一下官方文档: ...

  4. [No000013C]B树、B-树、B+树、B*树

    B树 即二叉搜索树: 1.所有非叶子结点至多拥有两个儿子(Left和Right): 2.所有结点存储一个关键字: 3.非叶子结点的左指针指向小于其关键字的子树,右指针指向大于其关键字的子树: 如: B ...

  5. 主从读写分离----mysql-proxy0.8.5安装与配置

    废话不多说,直接开干: 1.安装环境: yum -y install libevent glib2 lua gcc gcc-c++ autoconf mysql-devel libtool pkgco ...

  6. bilibili的直播第三方IJKMediaFramework.framework下载打包使用教程

    参考和引用的地址: http://www.code4app.com/thread-8941-1-1.html http://blog.csdn.net/cccallen/article/details ...

  7. lumen

    HTTP路由 基本路由 路由参数 必填参数 可选参数 正则表达式约束 命名路由 路由组 中间件 命令空间 路由前缀 基本路由 你可以在 route/web.php 文件中定义应用程序的全部路由.最基本 ...

  8. [http][ident] ident协议

    读<http权威指南>提到了ident协议. 接受客户端连接 在这个步骤中,包括建立连接,这里Web服务器可以随意拒绝或立即关闭任意一条连接.客户端主机名解析部分,服务器可以用“反向DNS ...

  9. 分析占用了大量 CPU 处理时间的是Java 进程中哪个线程

    下面是详细步骤: 1. 首先确定进程的 ID ,可以使用 jps -v 或者 top 命令直接查看 2. 查看该进程中哪个线程占用大量 CPU,执行 top -H -p [PID] 结果如下: 可以发 ...

  10. dbtool部署

    dbtool工具部署 a.附件解压到/home/oracle/dbtool b.执行以下命令chmod 755 /home/oracle/dbtool/*.shecho "alias dbt ...