LeetCode 620 有趣的電影

2021-09-25 03:30:24 字數 1167 閱讀 1665

題目:

作為該電影院的資訊部主管,您需要編寫乙個 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 |

±--------±----------±-------------±----------+

題解:

//1

select

*from cinema where description!=

'boring'

andmod

(id,2)

=1order

by rating desc

;//2

select

*from cinema where description not

like

'boring'

and id%2=

1order

by rating desc

;

LeetCode 620 有趣的電影

作為該電影院的資訊部主管,您需要編寫乙個 sql查詢,找出所有影片描述為非 boring 不無聊 的並且 id 為奇數 的影片,結果請按等級 rating 排列。問題說的很清楚了,就是篩選出來有趣的電影,那麼開始就是select from cinema。接下來是限定條件,限定它的描述不能是borin...

6 20培訓記錄

1.命名規則 私有變數前面加 公有的大寫 集合類的 可以使用複數 或者 增加 list結尾 2.物件的初始化,放在bll層的 setinitial 方法裡 uconfig的初始化 一些屬性的必填什麼的驗證,寫在vailitly什麼的方法裡 3.頁面 盡量的乾淨,整潔 一些 可以放到service和b...

創新實訓6 20

整理之前寫好的 結構,正式開始我們的專案 flaskenv test watchlist.py watchlist 程式包 其他自己的js檔案 templates base.html edit.html errors 400.html 404.html 500.html index.html log...