题目:

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

代码:

 SELECT * FROM cinema
WHERE (id%2 = 1) AND (description <> "boring")
ORDER BY rating DESC

LeetCode: 620 Not Boring Movies(easy)的更多相关文章

  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 (有趣的电影)

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

  4. [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 ...

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

  6. [array] leetcode - 35. Search Insert Position - Easy

    leetcode - 35. Search Insert Position - Easy descrition Given a sorted array and a target value, ret ...

  7. [LeetCode] 038. Count and Say (Easy) (C++/Python)

    索引:[LeetCode] Leetcode 题解索引 (C++/Java/Python/Sql) Github: https://github.com/illuz/leetcode 038. Cou ...

  8. [Swift]LeetCode620. 有趣的电影 | Not Boring Movies

    SQL架构 Create table If Not Exists cinema (id ), description varchar(), rating , )) Truncate table cin ...

  9. Leetcode解题思路总结(Easy篇)

    终于刷完了leetcode的前250道题的easy篇.好吧,其实也就60多道题,但是其中的套路还是值得被记录的. 至于全部code,请移步github,题目大部分采用python3,小部分使用C,如有 ...

随机推荐

  1. JS 模板引擎 Handlebars.js 中文说明

    Handlebars 为你提供了一个可以毫无挫折感的高效率书写 语义化的模板 所必需的一切. Mustache 模板和 Handlebars 是兼容的,所以你可以把Mustache模板拿来导入到Han ...

  2. 安装openSUSE网卡驱动

    网卡:英特尔 82579LM Gigabit Network Connection 先去英特尔的网站下载驱动 http://downloadcenter.intel.com/SearchResult. ...

  3. 使用Auto Layout处理比例间距问题

    使用Auto Layout处理比例间距问题 Auto Layout 是一个掌握起来很具有挑战性的东西.iOS 9引入的 Stack Views和 layout 锚点有一些帮助,但是明白如何创建特定的 ...

  4. bzoj1458 士兵占据

    1458: 士兵占据 Time Limit: 10 Sec  Memory Limit: 64 MB Submit: 685  Solved: 398 [Submit][Status][id=1458 ...

  5. 关于TIME_WAIT状态

    前言 为何TCP ”四次分手“ 的过程中会有一个TIME_WAIT状态?这个状态有什么意义呢?这是网络中的一个经典问题,本文将给出精简的回答. 什么是TIME_WAIT状态 这是TCP通信协议中出现的 ...

  6. 未开启HugePages ORACLE session剧增时引起的一次悲剧

    故障简单描写叙述一下:LINUX系统未开启HugePages,主机内存将近300G.SWAP是32G.ORACLE 的 SGA_MAX_SIZE设置是主机内存的将近80%,SGA_TARGET设置是主 ...

  7. 【BZOJ1414/3705】[ZJOI2009]对称的正方形 二分+hash

    [BZOJ1414/3705][ZJOI2009]对称的正方形 Description Orez很喜欢搜集一些神秘的数据,并经常把它们排成一个矩阵进行研究.最近,Orez又得到了一些数据,并已经把它们 ...

  8. 那些让你代码思维和能力有较大的提升Java源码(转)

    对于学习J2EE的框架有很大的帮助,代码里使用了各种设计模式.事件机制.Java8语法.代码量也很小,web服务使用Netty作为支持,对HTTP/网络想研究的一定是你的必读品.目前在写 Blade- ...

  9. ElasticSearch(八)关于document的一些知识点

    先查看一条数据: GET /ecommerce/product/5 { "_index" : "ecommerce", "_type" : ...

  10. CAN协议与CANOpen协议

    这里详细介绍了CAN协议中数据通信帧每位的含义,有图片,值得一看:https://www.cnblogs.com/pejoicen/p/3986587.html 这里介绍了CanOpen协议,http ...