Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Have a good contributing!
- [596. Classes With at Least 5 Students](./leetcode/easy/596.%20Classes%20With%20at%20Least%205%20Students.sql)
- [610. Triangle Judgement](./leetcode/easy/610.%20Triangle%20Judgement.sql)
- [619. Biggest Single Number](./leetcode/easy/619.%20Biggest%20Single%20Number.sql)
- [620. Not Boring Movies](./leetcode/easy/620.%20Not%20Boring%20Movies.sql)
2. [Medium](./leetcode/medium/)
- [176. Second Highest Salary](./leetcode/medium/176.%20Second%20Highest%20Salary.sql)
- [184. Department Highest Salary](./leetcode/medium/184.%20Department%20Highest%20Salary.sql)
Expand Down
43 changes: 43 additions & 0 deletions leetcode/easy/620. Not Boring Movies.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,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