题目:

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. 关于arr.map()问题

    最近看map实现原理, Array.prototype._map = function(fn, context) { console.log(fn, context) var temp = []; i ...

  2. ASP.NET MVC模式——WebPages

    WebPages 示例 123456<html> <body> <h1>Hello Web Pages</h1> <p>The time i ...

  3. PHP获取IP

    <?php $iipp = $_SERVER["REMOTE_ADDR"]; echo $iipp ; ?>

  4. Oracle比较时间大小

    1,比较当前时间与指定时间相差分钟数:    select sysdate,  sysdate - to_date('2007-04-03 13:45:39','yyyy-mm-dd hh24:mi: ...

  5. EasyDarwin开源流媒体服务器低延时直播之转发缓存跟进算法

    前言 前一段时间,我们为EasyDarwin实现了客户端快速显示画面/听到同步声音的缓存关键帧检索方案,具体的实现方法分别在<EasyDarwin手机直播是如何实现的快速显示视频的方法>和 ...

  6. mybatis学习总结(三)——增删查改

    映射器是mybatis的基础和核心,下面学习下映射器的使用 映射器的主要元素 select  查询语句,可以自定义参数和返回结果集 insert  插入语句,返回一个整数,代表插入的条数 update ...

  7. wprintf、wcout无法输出中文的解决方案

    在C语言中,若wprintf无法输出中文,调用函数setlocale(int category, const char *locale)设置locale即可输出中文 此方法也可用于C++中 例: #i ...

  8. 【智能无线小车系列十】通过USB摄像头实现网络监控功能

    如果仅有静态图像可能还不足以满足我们的需求,我们可能会需要用到实时的监控功能.这里介绍一款小应用:motion.motion的功能可强大了,不仅可以将监控的画面通过视频传输,实时展现,更为强大的是,m ...

  9. 火狐浏览器使用firebug获取xpath和css path

    工作中,常常会用到网页元素的定位方式,常用的有xpath和css path两种定位方式. 现在简单介绍如何使用工具自动生成元素的定位字符串. 首先介绍在火狐浏览器上使用FireBug及其扩展FireP ...

  10. 常用git命令和工具

    0. ln -s src_dir  //一个参数即可在当前目录下生成一个软链接   1.git command --clone/push a branch      git clone <url ...