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 |
+---------+-----------+--------------+-----------+ 查询出id为奇数,description不是boring,按rating降序的 MySQL(159ms):
# Write your MySQL query statement below
SELECT id , movie , description , rating
FROM cinema
WHERE id&1 AND description != 'boring'
ORDER BY rating DESC ;
620. Not Boring Movies的更多相关文章
- 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(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 用where语句判断
https://leetcode.com/problems/not-boring-movies/description/ 不管题目简不简单,现在先熟悉语法. 直接用where语句判断即可,判断奇偶可以 ...
- LeetCode 620. Not Boring Movies (有趣的电影)
题目标签: 题目给了我们一个 cinema 表格, 让我们找出 不无聊的电影,并且id 是奇数的,降序排列. 比较直接简单的,具体看code. Java Solution: Runtime: 149 ...
- [Swift]LeetCode620. 有趣的电影 | Not Boring Movies
SQL架构 Create table If Not Exists cinema (id ), description varchar(), rating , )) Truncate table cin ...
- [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 ...
- All LeetCode Questions List 题目汇总
All LeetCode Questions List(Part of Answers, still updating) 题目汇总及部分答案(持续更新中) Leetcode problems clas ...
- Leetcode中的SQL题目练习(一)
595. Big Countries https://leetcode.com/problems/big-countries/description/ Description name contine ...
- 【sql】leetcode习题 (共 42 题)
[175]Combine Two Tables (2018年11月23日,开始集中review基础) Table: Person +-------------+---------+ | Column ...
随机推荐
- 使用snmp4j实现Snmp功能(二)
相关链接:Snmp学习笔记使用snmp4j实现Snmp功能(一)使用snmp4j实现Snmp功能(二)使用snmp4j实现Snmp功能(三) 前一篇文章讲了如何用snmp4j实现set和get的功能, ...
- UIView的autoresizingMask属性研究
在 UIView 中有一个autoresizingMask的属性,它对应的是一个枚举的值(如下),属性的意思就是自动调整子控件与父控件中间的位置,宽高. 1 2 3 4 5 6 7 8 9 enum ...
- Leetcode 380. 常数时间插入、删除和获取随机元素
1.题目描述 设计一个支持在平均 时间复杂度 O(1) 下,执行以下操作的数据结构. insert(val):当元素 val 不存在时,向集合中插入该项. remove(val):元素 val 存在时 ...
- 管理页面的 setTimeout & setInterval
在管理 setTimeout & setInterval 这两个 APIs 时,笔者通常会在顶级(全局)作用域创建一个叫 timer 的对象,在它下面有两个数组成员 —— {sto, siv} ...
- git--------------bug修复流程
当前所有分支: master:主分支 test:测试分支 zs:开发人员分支 ls:开发人员分支 场景:zs正在开发A模块功能,线上环境产生了一个bug. zs的操作流程(当前分支为zs分支): 1. ...
- mysql 修改max_connections
1.使用命令show variables 来查看当前最大连接数 show variables like '%max_connections%'; 使用命令set global max_connecti ...
- idea如何搭建springmvc4
1.推荐大牛博客 此操作我操作了三次过后终于成功了,奉献大牛博客连接:做的非常详细到位,望各位采纳,推荐置顶. https://www.cnblogs.com/chenlinghong/p/83395 ...
- js_面向对象设计和行为委托设计模式
最近换了新工作,面试过程中有多多少少的问题没有给的出答案,为自己的技术短板而促急. javascript中万物皆对象(键:值构成的一种数据),暂且不讨论这个句话的对与错,可以想象对象在javascri ...
- (Git 钩子)自定义你的工作流 和引用日志
Git 钩子是在 Git 仓库中特定事件发生时自动运行的脚本.它可以让你自定义 Git 内部的行为,在开发周期中的关键点触发自定义的行为. Git 钩子最常见的使用场景包括推行提交规范,根据仓库状态改 ...
- PKUWC 2019 自闭记
PKUWC 2019 自闭记 Day -1 考前天天在隔壁的物竞教室划水(雀魂,能和吉老师一起玩的游戏都是好游戏),没有做题. Day 0 早上8:16的高铁,到广州南居然要6个小时...不知道福州和 ...