题目:

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:

  1. +---------+-----------+--------------+-----------+
  2. | id | movie | description | rating |
  3. +---------+-----------+--------------+-----------+
  4. | 1 | War | great 3D | 8.9 |
  5. | 2 | Science | fiction | 8.5 |
  6. | 3 | irish | boring | 6.2 |
  7. | 4 | Ice song | Fantacy | 8.6 |
  8. | 5 | House card| Interesting| 9.1 |
  9. +---------+-----------+--------------+-----------+

For the example above, the output should be:

  1. +---------+-----------+--------------+-----------+
  2. | id | movie | description | rating |
  3. +---------+-----------+--------------+-----------+
  4. | 5 | House card| Interesting| 9.1 |
  5. | 1 | War | great 3D | 8.9 |
  6. +---------+-----------+--------------+-----------+

代码:

  1. SELECT * FROM cinema
  2. WHERE (id%2 = 1) AND (description <> "boring")
  3. 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. IMDB-WIKI - 具有年龄和性别标签的500k +脸部图像

    Rasmus Rothe, Radu Timofte, Luc Van Gool DEX:从单一形象深刻地看待年龄 观看 人物研讨会国际计算机视觉大会(ICCV),2015*获胜LAP面对年龄估计的挑 ...

  2. 使用 lstat 函数获取文件信息

    前言 在之前的文章中,描述过如何用 fcntl 函数改变文件的状态标记.但,文件还有很多信息,如文件类型,权限设置,设备编号,访问时间等等.如果要获取这些信息,则使用函数 lstat 可以轻松达到这个 ...

  3. Lua_第17 章 数学库

    第17 章 数学库 在这一章中(以下关于标准库的几章中相同)我的主要目的不是对每个函数给出完整地说明,而是告诉你标准库可以提供什么功能.为了可以清楚地说明问题,我可能 会忽略一些小的选项或者行为.基本 ...

  4. 零基础学python-2.18 异常

    这一节说一下异常except 继续沿用上一节的代码.我有益把文件名称字搞错.然后在结尾部分加上异常捕捉: try: handler=open("12.txt")#在这里我特别将文件 ...

  5. (转)c#(wince)中使用多线程访问winform中控件的问题

    我们在做winform应用的时候,大部分情况下都会碰到使用多线程控制界面上控件信息的问题.然而我们并不能用传统方法来做这个问题,下面我将详细的介绍. 首先来看传统方法:  public partial ...

  6. 基于Netty自研网关中间件

    微服务网关解决方案调研和使用总结 专题 - 沧海一滴 - 博客园 https://www.cnblogs.com/softidea/p/7261095.html 宜人贷蜂巢API网关技术解密之Nett ...

  7. 看不懂JDK8的流操作?5分钟带你入门(转)

    在JDK1.8里有两个非常高级的新操作,它们分别是:Lambda 表达式和 Stream 流. Lambda表达式 让我们先说说 Lambda 表达式吧,这个表达式最大的作用就是简化语法,让代码更加易 ...

  8. Android笔记之在onCreate中执行View.getWidth()和View.getHeight()得到的结果均为0的解决方案

    方案有多种,只记一种 使用View.post(Runnable) 示例如下 Log如下 由log可知,View.post(Runnable)是异步的

  9. TTimer源码研究

    TTimerProc = procedure of object; IFMXTimerService = interface(IInterface) ['{856E938B-FF7B-4E13-85D ...

  10. 2014 ACM-ICPC Beijing Invitational Programming Contest

    点击打开链接 Happy Reversal Time Limit: 1000ms Memory Limit: 65536KB 64-bit integer IO format: %lld      J ...