https://windsuzu.github.io/leetcode-620/
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.
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.
X City 開了一間電影院, 這間電影院給客人提供了一張海報,上面寫著每部電影的評價與評論。
現在請用 SQL 查出奇數的電影 ID,還有評論不為’boring’的電影,最後依評價最高到最低列出來。
現在請用 SQL 查出奇數的電影 ID,還有評論不為’boring’的電影,最後依評價最高到最低列出來。
For example, table cinema:
|
|
For the example above, the output should be:
|
|
SELECT * FROM cinema WHERE description != 'boring' AND (id%2) = 1 ORDER BY rating DESC
SELECT * FROM cinema WHERE (id % 2 = 1) AND (description <> 'boring') ORDER BY rating DESC