[LeetCode] 620. Not Boring Movies_Easy tag: SQL
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的更多相关文章
- 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 ...
- leetcode 620. Not Boring Movies 用where语句判断
https://leetcode.com/problems/not-boring-movies/description/ 不管题目简不简单,现在先熟悉语法. 直接用where语句判断即可,判断奇偶可以 ...
- 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 ...
- LeetCode 620. Not Boring Movies (有趣的电影)
题目标签: 题目给了我们一个 cinema 表格, 让我们找出 不无聊的电影,并且id 是奇数的,降序排列. 比较直接简单的,具体看code. Java Solution: Runtime: 149 ...
- [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 ...
- [LeetCode] 176. Second Highest Salary_Easy tag: SQL
Write a SQL query to get the second highest salary from the Employee table. +----+--------+ | Id | S ...
- [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 ...
- [LeetCode] 584. Find Customer Referee_Easy tag: SQL
Given a table customer holding customers information and the referee. +------+------+-----------+ | ...
- [LeetCode] 603. Consecutive Available Seats_Easy tag: SQL
Several friends at a cinema ticket office would like to reserve consecutive available seats.Can you ...
随机推荐
- react-native 搭建环境
1.安装 nodejs 配置环境变量 node -v npm -v 2.安装 javaSE 1.8以上 http://www.oracle.com/technetwork/java/javase/ar ...
- HTTP Error 400. The request hostname is invalid
HTTP Error 400. The request hostname is invalid 错误, 检查服务的iis服务得知,是因为在绑定主机和端口的那一步时也指定了相应的域名. 解决办法: 去掉 ...
- css学习_标签的显示模式
标签的显示模式 a.块级元素(最典型的是 div标签) 特点: 默认宽度 100% 可以容纳块级元素和内联元素 b.行内元素 (最典型的是 span标签) 特点: c.行内块元素(最典型的是 i ...
- [No0000C9]神秘的掐指一算是什么?教教你也会
很多朋友看到传说中诸葛亮以及那些聪明人掐指一算,惊叹不已.那些人以“察天地之理.通鬼神之志”,每次占卜时,做一大堆的神秘仪式,然后掐指一算,便大有“乾坤尽收在手”的感觉.在普通人眼里,他们的手神秘异常 ...
- C语言保证,0永远不是有效的数据地址,因此,返回址0可用来表示发生的异常事件
C语言保证,0永远不是有效的数据地址,因此,返回址0可用来表示发生的异常事件
- Java8 in action
解决的问题: behavior parameterization,即可以把一段code,逻辑作为参数传入: 这样做的目的,当然为了代码抽象和重用,把变化的逻辑抽象出去: 在java中,如果要实现beh ...
- oracle优化:避免全表扫描
http://blog.csdn.net/onetree2010/article/details/6098259
- NPM升级
nmp的更新可以使用自身指令即可: npm install npm -g 可以看到从3.10.10升级到了4.0.5 都说npm比node升级的快,现在比起来nodejs的更新速度更快 如果npm官方 ...
- IntelliJ常用设置及快捷键
转自: http://www.blogjava.net/rockblue1988/archive/2014/10/25/418994.html 一.黑色主题 Darcula眼睛舒服,最重要的是酷!设置 ...
- oracle按照指定列排序操作
按照...分组排序后,得到行编号: row_number() over(partition by ... order by ...) 按照...分组排序后,得到相应的列的第一个数据: first_va ...