Hint and exampleShowHide
Combine an odd-number test such as MOD(id, 2) = 1 with a text inequality, and sort the result in descending order.
Example: songs(id, genre, plays)
id | genre | plays
1 | pop | 90
2 | rock | 70
3 | remix | 95
5 | jazz | 40
SELECT *
FROM songs
WHERE MOD(id, 2) = 1 AND genre <> 'remix'
ORDER BY plays DESC; -- returns id 1, then id 5
More in SQL: SELECT & Filtering
| # | Problem | Platform | Difficulty | Open | 1st1st Visit | 2nd2nd Visit | RevRevise |
|---|---|---|---|---|---|---|---|
| 1 | Recyclable and Low Fat Products | LeetCode | Easy | Solve Recyclable and Low Fat Products on LeetCode (opens in a new tab) | |||
| 2 | Big Countries | LeetCode | Easy | Solve Big Countries on LeetCode (opens in a new tab) | |||
| 3 | Article Views I | LeetCode | Easy | Solve Article Views I on LeetCode (opens in a new tab) | |||
| 4 | Not Boring Movies | LeetCode | Easy | Solve Not Boring Movies on LeetCode (opens in a new tab) | |||
| 5 | Find Customer Referee | LeetCode | Easy | Solve Find Customer Referee on LeetCode (opens in a new tab) |