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

Code

SELECT id, movie, description, rating FROM cinema WHERE mod(id,2) != 0 AND description != 'boring' ORDER BY rating DESC

[LeetCode] 620. Not Boring Movies_Easy tag: SQL的更多相关文章

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

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

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

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

  5. [LeetCode] 619. Biggest Single Number_Easy tag: SQL

    Table number contains many numbers in column num including duplicated ones.Can you write a SQL query ...

  6. [LeetCode] 176. Second Highest Salary_Easy tag: SQL

    Write a SQL query to get the second highest salary from the Employee table. +----+--------+ | Id | S ...

  7. [LeetCode] 196. Delete Duplicate Emails_Easy tag: SQL

    Write a SQL query to delete all duplicate email entries in a table named Person, keeping only unique ...

  8. [LeetCode] 584. Find Customer Referee_Easy tag: SQL

    Given a table customer holding customers information and the referee. +------+------+-----------+ | ...

  9. [LeetCode] 603. Consecutive Available Seats_Easy tag: SQL

    Several friends at a cinema ticket office would like to reserve consecutive available seats.Can you ...

随机推荐

  1. QInputDialog Multiple Inputs 输入多个变量的对话框

    在之前的博客QInputDialog 使用方法中展示了利用QInputDialog可以快速通过一行代码来生成一个输入框,来获取用户的输入值,那么如果我们希望获取多个输入值,怎么办呢?那么此时用QInp ...

  2. Servlet3.0 multipart 文件上传技术

    Servlet3.0 javaConfig配置 传统的servlet都是在web.xml中配置,从Servlet 3.0开始提供了ServletContainerInitializer接口,允许使用代 ...

  3. 三剑客之grep

    简介 grep (global search regular expression(RE) and print out the line,全面搜索正则表达式并把行打印出来)是一种强大的文本搜索工具,它 ...

  4. VS2015 工具箱 保存位置

    我的文档\Visual Studio 2015\Settings\CurrentSettings.vssettings Environment_Toolbox 节点 <Category name ...

  5. 【TOP100案例专访】当当网工程师林嘉琦谈双11大促经验及APM实践

    导读:第七届TOP100全球软件案例研究峰会将于11月30日-12月3日在北京国家会议中心举办,本届峰会以“释放AI生产力 让组织向智能化演进”为开幕式主题,旨在推动企业在趋势下拥抱AI.探索和思考A ...

  6. [No0000150]VSVisualStudio提示图标,信号图标的含义

    其右侧的图标表示这是一个接口类型__interface(或者是结构体类型) 其右侧图标表示这是一个类类型 其右侧图标表示这是一个.cpp文件(貌似还可以是.hpp等文件) 其右侧图标表示这是一个枚举类 ...

  7. springboot的filter使用

    package com.filter; import org.springframework.core.annotation.Order; import javax.servlet.*; import ...

  8. Java基础知识之集合

    Collection集合 特点:长度可变,只能存储引用类型,可以存储不同的类型的元素 list 特点:元素有序(存储和取出的顺序一致),元素可以重复.list除了可以用迭代器循环遍历之外,因为其是有序 ...

  9. 【Python全栈-HTML】HTML如何做出分割线效果

    参考: https://blog.csdn.net/weixin_39198406/article/details/78827671 一.普通效果 <hr> <hr align=ce ...

  10. 关于javascript中defineProperty的学习

    语法 Object.defineProperty(obj, prop, descriptor) 参数 obj 要在其上定义属性的对象. prop 要定义或修改的属性的名称. descriptor 将被 ...