Skip to content

Commit f7183ef

Browse files
refactor 620
1 parent 4ed4db9 commit f7183ef

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

database/_620.sql

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
--620. Not Boring Movies
2+
--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.
3+
--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.
4+
--
5+
--
6+
--
7+
--For example, table cinema:
8+
--
9+
--+---------+-----------+--------------+-----------+
10+
--| id | movie | description | rating |
11+
--+---------+-----------+--------------+-----------+
12+
--| 1 | War | great 3D | 8.9 |
13+
--| 2 | Science | fiction | 8.5 |
14+
--| 3 | irish | boring | 6.2 |
15+
--| 4 | Ice song | Fantacy | 8.6 |
16+
--| 5 | House card| Interesting| 9.1 |
17+
--+---------+-----------+--------------+-----------+
18+
--For the example above, the output should be:
19+
--+---------+-----------+--------------+-----------+
20+
--| id | movie | description | rating |
21+
--+---------+-----------+--------------+-----------+
22+
--| 5 | House card| Interesting| 9.1 |
23+
--| 1 | War | great 3D | 8.9 |
24+
--+---------+-----------+--------------+-----------+
25+
126
select id, movie, description, rating
227
from cinema where mod (id, 2) = 1
328
and description not like 'boring'

0 commit comments

Comments
 (0)