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 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为奇数,评价不是boring 的电影按rating从高到低排列

select * from cinema where mod(id,2) = 1 and description !=‘boring‘ order by rating desc;

 主要考查的是sql的mod函数的用法

原文地址:https://www.cnblogs.com/icysnow/p/8182896.html

时间: 2024-10-22 12:13:59

620. Not Boring Movies的相关文章

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

【sql】leetcode习题 (共 42 题)

p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica } [175]Combine Two Tables [176]Second Highest Salary [177]Nth Highest Salary [178]Rank Scores [180]Consecutive Numbers [181]Employees Earning More Than Their Managers [182]Duplicate Email

LeetCode数据库习题182,595,620,175,183,181,596

182.查找重复的电子邮箱 编写一个 SQL 查询,查找 Person 表中所有重复的电子邮箱. 示例: +----+---------+ | Id | Email | +----+---------+ | 1 | [email protected] | | 2 | [email protected] | | 3 | [email protected] | +----+---------+ 根据以上输入,你的查询应返回以下结果: +---------+ | Email | +---------+

hihoCoder 1430 : A Boring Problem(一琐繁题)

hihoCoder #1430 : A Boring Problem(一琐繁题) 时间限制:1000ms 单点时限:1000ms 内存限制:256MB Description - 题目描述 As a student of the school of electronics engineering and computer science in Peking University, Kyle took the course named Advanced Algebra in his freshma

hdu 5008(2014 ACM/ICPC Asia Regional Xi'an Online ) Boring String Problem(后缀数组&二分)

Boring String Problem Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 219    Accepted Submission(s): 45 Problem Description In this problem, you are given a string s and q queries. For each que

BNUOJ 7629 Boring counting

Boring counting Time Limit: 1000ms Memory Limit: 32768KB This problem will be judged on HDU. Original ID: 351864-bit integer IO format: %I64d      Java class name: Main 035 now faced a tough problem,his english teacher gives him a string,which consis

NOKIA Lumia 620

此页面为WP8"NOKIA Lumia 620"应用的发布页面. "NOKIA Lumia 620"是一款收集Lumia620的玩机技巧的WP8程序,更好的帮助Lumia用户理解并使用620. 此页面主要记录开发进度.APP发布等情况. -------------------相关进度--------------------- 目前进度:UI相关资源前期准备中,各相关开放平台的AppID申请中... NOKIA Lumia 620,布布扣,bubuko.com

13年山东省赛 Boring Counting(离线树状数组or主席树+二分or划分树+二分)

转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud 2224: Boring Counting Time Limit: 3 Sec  Memory Limit: 128 MB Description In this problem you are given a number sequence P consisting of N integer and Pi is the ith element in the sequence.

HDU - 5190 - Go to movies && 5191 - Building Blocks (BC#34 A,B)

Go to movies Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 99    Accepted Submission(s): 67 Problem Description Winter holiday is coming!As the monitor, LeLe plans to go to the movies. Becaus