Skip to content

Commit 5797e3d

Browse files
committed
Upload 182
1 parent b2ac965 commit 5797e3d

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ Because this project necessitated a framework to enable consistent daily practic
215215
| 179 | [Friendly Movies Streamed Last Month](https://leetcode.com/problems/friendly-movies-streamed-last-month/description/) | [Solution](solutions/179_friendly_movies_streamed_last_month.md) | LeetCode | Easy | |
216216
| 180 | [Books with NULL Ratings](https://leetcode.com/problems/books-with-null-ratings/description/) | [Solution](solutions/180_books_with_null_ratings.md) | LeetCode | Easy | |
217217
| 181 | [Customer Order Frequency](https://leetcode.com/problems/customer-order-frequency/description/) | [Solution](solutions/181_customer_order_frequency.md) | LeetCode | Easy | `USING`, `HAVING` |
218+
| 182 | [Low-Quality Problems](https://leetcode.com/problems/low-quality-problems/description/) | [Solution](solutions/182_low_quality_problems.md) | LeetCode | Easy | |
218219
<!-- Index End - WARNING: Do not delete or modify this markdown comment. -->
219220
<!--- cSpell:enable --->
220221

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# SQL Everyday \#182
2+
3+
## Low-Quality Problems
4+
5+
Site: LeetCode\
6+
Difficulty per Site: Easy
7+
8+
## Problem
9+
10+
Find the IDs of the **low-quality problems**. A LeetCode problem is **low-quality** if the like percentage of the problem (number of likes divided by the total number of votes) is **strictly less than** `60%`.
11+
12+
Return the result table ordered by `problem_id` in ascending order. [[Full Description](https://leetcode.com/problems/low-quality-problems/description/)]
13+
14+
## Submitted Solution
15+
16+
```sql
17+
-- Submitted Solution
18+
SELECT
19+
problem_id
20+
FROM (
21+
SELECT
22+
problem_id
23+
,1.00 * likes / (likes + dislikes) AS quality
24+
FROM Problems
25+
) AS p
26+
WHERE quality < .6
27+
ORDER BY problem_id ASC
28+
;
29+
```
30+
31+
## Site Solution
32+
33+
```sql
34+
-- LeetCode Solution
35+
-- None
36+
37+
-- Code Author: byuns9334
38+
-- https://leetcode.com/problems/low-quality-problems/solutions/1562160/simple-mssql
39+
SELECT
40+
a.problem_id
41+
FROM Problems AS a
42+
WHERE a.likes * 2 < a.dislikes * 3
43+
ORDER BY a.problem_id ASC
44+
;
45+
46+
-- Code Author: Parantika
47+
-- https://leetcode.com/problems/low-quality-problems/solutions/1499691/ms-sql
48+
SELECT
49+
problem_id
50+
FROM problems
51+
WHERE likes / cast((likes + dislikes) AS float) < 0.6
52+
ORDER BY problem_id
53+
;
54+
```
55+
56+
## Notes
57+
58+
TBD
59+
60+
## NB
61+
62+
TBD
63+
64+
Go to [Index](../?tab=readme-ov-file#index)\
65+
Go to [Overview](../?tab=readme-ov-file)

0 commit comments

Comments
 (0)