日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

[LeetCode] 620.Not Boring Movies

發布時間:2023/12/29 编程问答 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 [LeetCode] 620.Not Boring Movies 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

[LeetCode] 620.Not Boring Movies

  • 題目描述
  • 解題思路
  • 實驗代碼

題目描述

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.

For example, table cinema:

idmoviedescriptionrating
1Wargreat 3D8.9
2Sciencefiction8.5
3irishboring6.2
4Ice songFantacy8.6
5House cardInteresting9.1


For the example above, the output should be:

idmoviedescriptionrating
5House cardInteresting9.1
1Wargreat 3D8.9

解題思路

SQL第三彈,說實話博主不怎么清楚SQL具體語句,去年學過的數據庫方面的知識忘得差不多了哈哈哈。所以不知道寫出來是否符合標準,不過確實是AC了,憑回憶寫的。這道題注意三個條件:
1. 選擇出來的id要為奇數; (id % 2 = 1)
2. description不能為boring; (description <> ‘boring’)
3. 選擇出來的數據按rating倒序排序。 (ORDER BY rating DESC)
具體見代碼。

實驗代碼

# Write your MySQL query statement below SELECT * FROM cinema WHERE (description <> 'boring') AND (id % 2 = 1) ORDER BY rating DESC

總結

以上是生活随笔為你收集整理的[LeetCode] 620.Not Boring Movies的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。