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的更多相关文章

  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(easy)

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

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

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

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

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

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

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

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

  7. All LeetCode Questions List 题目汇总

    All LeetCode Questions List(Part of Answers, still updating) 题目汇总及部分答案(持续更新中) Leetcode problems clas ...

  8. Leetcode中的SQL题目练习(一)

    595. Big Countries https://leetcode.com/problems/big-countries/description/ Description name contine ...

  9. 【sql】leetcode习题 (共 42 题)

    [175]Combine Two Tables (2018年11月23日,开始集中review基础) Table: Person +-------------+---------+ | Column ...

随机推荐

  1. sublime Text 块编辑方法

    比如我们要把SQL语句中的多表查询结果封装成pojo SQL: SELECT a.id, a.title, a.sell_point, a.price, a.image, b.`name` categ ...

  2. Picture POJ - 1177 (线段树-扫描线)

    A number of rectangular posters, photographs and other pictures of the same shape are pasted on a wa ...

  3. HDU3579 线性同余方程(模板 余数不一定互质)

    Hello Kiki Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Su ...

  4. [freemarker篇]03.如何处理空值

    我想说的一点,我写的东西没有那么权威,这都是我实际开发中使用的,可能缺少很多! 例如这篇要说的如何处理空值,我发现我使用的跟网上很多写的不太一样,我也没有过多的去尝试网上的那么多写法! 抱歉,我只是写 ...

  5. [LeetCode] 1. Two Sum ☆

    Given an array of integers, return indices of the two numbers such that they add up to a specific ta ...

  6. android之解析json数据格式详解

    1.JSON解析     (1).解析Object之一: view sourceprint? 1 {"url":"http://www.cnblogs.com/qianx ...

  7. ZooKeeper概述(三)

    ZooKeeper:分布式应用的分布协调服务 ZooKeeper是一个为分布式应用提供的分布的开源的协调服务.它暴露一组简单的原子操作,分布式系统可以在这之上为同步,配置管理,和组和命名实现更高级的服 ...

  8. Item 30 用enum代替int常量类型枚举,string常量类型枚举

    1.用枚举类型替代int枚举类型和string枚举类型 public class Show {   // Int枚举类型   // public static final int APPLE_FUJI ...

  9. 【51NOD-0】1046 A^B Mod C

    [算法]快速幂运算 [题解]快速幂的原理是把幂用二进制表示,从最低位a,次低位a2,次次低位(a2)2. #include<cstdio> long long quick_pow(long ...

  10. SCU 1029 Humble Numbers (打表处理)

    题目链接 题意:素因子中只有2 3 5 7的数称为谦逊的数,1也是谦逊的数,题目中已经给出了前20个谦逊的数.给定数字n,按格式输出第n个谦逊的数. 题解:打表即可,注意打表的技巧就行了. ps:这道 ...