Skip to content

Commit ca7cf31

Browse files
committed
task: #620
1 parent bc155bc commit ca7cf31

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Have a good contributing!
4545
- [596. Classes With at Least 5 Students](./leetcode/easy/596.%20Classes%20With%20at%20Least%205%20Students.sql)
4646
- [610. Triangle Judgement](./leetcode/easy/610.%20Triangle%20Judgement.sql)
4747
- [619. Biggest Single Number](./leetcode/easy/619.%20Biggest%20Single%20Number.sql)
48+
- [620. Not Boring Movies](./leetcode/easy/620.%20Not%20Boring%20Movies.sql)
4849
2. [Medium](./leetcode/medium/)
4950
- [176. Second Highest Salary](./leetcode/medium/176.%20Second%20Highest%20Salary.sql)
5051
- [184. Department Highest Salary](./leetcode/medium/184.%20Department%20Highest%20Salary.sql)
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
Question 620. Not Boring Movies
3+
Link: https://leetcode.com/problems/not-boring-movies/description/
4+
5+
Table: Cinema
6+
7+
+----------------+----------+
8+
| Column Name | Type |
9+
+----------------+----------+
10+
| id | int |
11+
| movie | varchar |
12+
| description | varchar |
13+
| rating | float |
14+
+----------------+----------+
15+
id is the primary key (column with unique values) for this table.
16+
Each row contains information about the name of a movie, its genre, and its rating.
17+
rating is a 2 decimal places float in the range [0, 10]
18+
19+
20+
Write a solution to report the movies with an odd-numbered ID and a description that is not "boring".
21+
22+
Return the result table ordered by rating in descending order.
23+
*/
24+
25+
SELECT
26+
id,
27+
movie,
28+
description,
29+
rating
30+
FROM Cinema
31+
WHERE id % 2 = 1 AND description != 'boring'
32+
ORDER BY rating DESC;
33+
34+
-- OR with ANSI SQL standard
35+
36+
SELECT
37+
id,
38+
movie,
39+
description,
40+
rating
41+
FROM Cinema
42+
WHERE id % 2 = 1 AND description <> 'boring' -- noqa: CV01
43+
ORDER BY rating DESC

0 commit comments

Comments
 (0)