leetcode 620. 有趣的電影

某城市開了一家新的電影院,吸引了很多人過來看電影。該電影院特別注意用戶體驗,專門有個 LED顯示板做電影推薦,上面公佈着影評和相關電影描述。

作爲該電影院的信息部主管,您需要編寫一個 SQL查詢,找出所有影片描述爲非 boring (不無聊) 的並且 id 爲奇數 的影片,結果請按等級 rating 排列。

例如,下表 cinema:

±--------±----------±-------------±----------+
| id | movie | description | rating |
±--------±----------±-------------±----------+
| 1 | War | great 3D | 8.9 |
| 2 | Science | fiction | 8.5 |
| 3 | irish | boring | 6.2 |
| 4 | Ice song | Fantacy | 8.6 |
| 5 | House card| Interesting| 9.1 |
±--------±----------±-------------±----------+

對於上面的例子,則正確的輸出是爲:

±--------±----------±-------------±----------+
| id | movie | description | rating |
±--------±----------±-------------±----------+
| 5 | House card| Interesting| 9.1 |
| 1 | War | great 3D | 8.9 |
±--------±----------±-------------±----------+

來源:力扣(LeetCode)
鏈接:https://leetcode-cn.com/problems/not-boring-movies
著作權歸領釦網絡所有。商業轉載請聯繫官方授權,非商業轉載請註明出處。

select *
from cinema
where description <> "boring" and id%2 = 1
order by rating desc;

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章