17.leetCode620: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 |
+———+———–+————–+———–+
题意:查询cinema表中id为奇数且description不为boring的电影,并将结果按rating从大到小进行排序。
代码:
select * from cinema
where mod(id,2)=1 and description != 'boring'
order by rating desc
判断一个数是否为奇数的方法:
1.mod(id,2)=1
2.id%2<>1 或 id%2!=0
17.leetCode620:Not Boring Movies相关推荐
- Leetcode PHP题解--D27 620. Not Boring Movies
620. Not Boring Movies 题目链接 620. Not Boring Movies 题目分析 前面铺垫了那么多,要求就在这: movies with an odd numbered ...
- [LeetCode] 620.Not Boring Movies
[LeetCode] 620.Not Boring Movies 题目描述 解题思路 实验代码 题目描述 X city opened a new cinema, many people would l ...
- LeetCode 从零单刷个人笔记整理(持续更新)
更新至2020.2.23 github:https://github.com/ChopinXBP/LeetCode-Babel 本人博客用于个人对知识点的记录和巩固. 用几乎所有可行的方法进行了实现和 ...
- LeetCode All in One 题目讲解汇总(持续更新中...)
原文地址:https://www.cnblogs.com/grandyang/p/4606334.html 终于将LeetCode的大部分题刷完了,真是漫长的第一遍啊,估计很多题都忘的差不多了,这次开 ...
- leetcode 数据库题目全部题解
来源链接:https://leetcode-cn.com/circle/article/vGr1Mc/ 对数据库专题下每道题目,包括会员题目,都做了详细的题解. 题解内容通常有这么几个部分,题目简述. ...
- 【sql】leetcode习题 (共 42 题)
[175]Combine Two Tables (2018年11月23日,开始集中review基础) Table: Person +-------------+---------+ | Column ...
- LeetCode 简单算法题
使用Nodejs 抓取的LeetCode 简单算法题 一步一步来,先攻破所有简单的题目,有些题目不适合使用JS解决,请自行斟酌 Letcode 简单题汇总 104. Maximum Depth of ...
- SQL leetcode刷题答案(一)
leetcode上刷SQL题的代码,仅供参考,毕竟答案不唯一,我的代码执行效率也不是很高 1.Combine Two Tables select FirstName, LastName, City, ...
- Boring counting HDU - 3518 (后缀数组)
Boring counting \[ Time Limit: 1000 ms \quad Memory Limit: 32768 kB \] 题意 给出一个字符串,求出其中出现两次及以上的子串个数,要 ...
最新文章
- Oracle去除表中重复记录
- php lalaogu cn,php安装编译时错误合集
- 在access窗体中加图片_Access实战:一种不用按钮控件就能控制子窗体联动的方法...
- wgs84坐标格式转换度分秒_一起爬山吗?寻找GIS坐标系统中“隐秘的角落”
- cocos2d-x初探学习笔记(8)--场景特效
- android短信增加条目,Android仿短信条目右上角的红色小圆球提示气泡
- 永不消逝的缓存数据:Adaptec 5445Z RAID卡评测(连载之一)
- python3-day4(re正则表达式,冒泡)
- C++标准库bitset类型(简单使用方法)
- 全通阅卷系统服务器配置,网上阅卷系统建设方案(24页)-原创力文档
- php开发微信小程序教程,从零开始开发微信小程序步骤(三)
- HTTP Security Header Not Detected
- [PAL规范]SAP HANA PAL 数据处理四分位间距检测Inter-quartile Range Test编程规范IQRTEST...
- 真正优秀的人,更懂得尊重别人
- android 车载app怎么开发,Android开发智能车载App(2)---android paint和canvas自定义view
- 【动手学树莓派】成为时代的弄潮儿,不做局外人
- 如何通俗理解 beta分布、汤普森采样和狄利克雷分布
- Python连接postgresql数据库入门
- 【机器学习算法】逻辑回归为什么叫逻辑回归
- 更相减损术--最大公约数
热门文章
- Office Excel 文件格式保存--兼容模式
- ie下ajax请求不到数据库,解决IE下Ajax请求无效
- 当前我国国产工业软件是怎样的局面?我们当前面临的宏观问题是什么?核心问题又是什么?...
- 区分:让项目评测更加公开透明
- 单片机连接有人云上传数据
- c语言中 static int,c语言中static unsigned int n=0;是什么意思?请大师指点迷津,学生有礼了。...
- 通过VS编码的UI测试来测试用户界面(一)
- Ember 翻译——教程十二:部署
- 别了,2010年南非世界杯足球赛
- Failed to connect to chromium.googlesource.com port 443: Operation timed out