diff --git a/README.md b/README.md index 22d54f3..e175fde 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/leetcode/easy/620. Not Boring Movies.sql b/leetcode/easy/620. Not Boring Movies.sql new file mode 100644 index 0000000..38ac24c --- /dev/null +++ b/leetcode/easy/620. Not Boring Movies.sql @@ -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