-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path620. Not Boring Movies.sql
More file actions
43 lines (35 loc) · 1.02 KB
/
620. Not Boring Movies.sql
File metadata and controls
43 lines (35 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
Question 620. Not Boring Movies
Link: https://leetcode.com/problems/not-boring-movies/description/
Table: Cinema
+----------------+----------+
| Column Name | Type |
+----------------+----------+
| id | int |
| movie | varchar |
| description | varchar |
| rating | float |
+----------------+----------+
id is the primary key (column with unique values) for this table.
Each row contains information about the name of a movie, its genre, and its rating.
rating is a 2 decimal places float in the range [0, 10]
Write a solution to report the movies with an odd-numbered ID and a description that is not "boring".
Return the result table ordered by rating in descending order.
*/
SELECT
id,
movie,
description,
rating
FROM Cinema
WHERE id % 2 = 1 AND description != 'boring'
ORDER BY rating DESC;
-- OR with ANSI SQL standard
SELECT
id,
movie,
description,
rating
FROM Cinema
WHERE id % 2 = 1 AND description <> 'boring' -- noqa: CV01
ORDER BY rating DESC