Skip to content

Commit c81ddc7

Browse files
committed
Upload 194
1 parent 5695251 commit c81ddc7

File tree

2 files changed

+60
-1
lines changed

2 files changed

+60
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!-- markdownlint-disable MD041 -->
22
[![eevveerryyddaayy release](https://img.shields.io/badge/eevveerryyddaayy-v1.3.0-blue.svg)](https://github.com/ggeerraarrdd/eevveerryyddaayy/)
3-
[![Solved](https://img.shields.io/badge/solved-193-green.svg)](#index)
3+
[![Solved](https://img.shields.io/badge/solved-194-green.svg)](#index)
44
<!-- markdownlint-enable MD041 -->
55

66
# SQL Everyday
@@ -227,6 +227,7 @@ Because this project necessitated a framework to enable consistent daily practic
227227
| 191 | [The Number of Rich Customers](https://leetcode.com/problems/the-number-of-rich-customers/description/) | [Solution](solutions/191_the_number_of_rich_customers.md) | LeetCode | Easy | |
228228
| 192 | [Find Candidates for Data Scientist Position](https://leetcode.com/problems/find-candidates-for-data-scientist-position/description/) | [Solution](solutions/192_find_candidates_for_data_scientist_position.md) | LeetCode | Easy | |
229229
| 193 | [Classifying Triangles by Lengths](https://leetcode.com/problems/classifying-triangles-by-lengths/description/) | [Solution](solutions/193_classifying_triangles_by_lengths.md) | LeetCode | Easy | |
230+
| 194 | [Reported Posts](https://leetcode.com/problems/reported-posts/description/) | [Solution](solutions/194_reported_posts.md) | LeetCode | Easy | |
230231
<!-- Index End - WARNING: Do not delete or modify this markdown comment. -->
231232
<!--- cSpell:enable --->
232233

solutions/194_reported_posts.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# SQL Everyday \#194
2+
3+
## Reported Posts
4+
5+
Site: LeetCode\
6+
Difficulty per Site: Easy
7+
8+
## Problem
9+
10+
Write a solution to report the number of posts reported yesterday for each report reason. Assume today is `2019-07-05`.
11+
12+
Return the result table in **any order**. [[Full Description](https://leetcode.com/problems/reported-posts/description/)]
13+
14+
## Submitted Solution
15+
16+
```sql
17+
-- Submitted Solution
18+
WITH cte AS (
19+
SELECT
20+
DISTINCT post_id
21+
,action_date
22+
,action
23+
,extra
24+
FROM Actions
25+
WHERE action_date = DATE '2019-07-05' - INTERVAL '1 day'
26+
AND action = 'report'
27+
)
28+
SELECT
29+
extra AS report_reason
30+
,COUNT(extra) AS report_count
31+
FROM CTE
32+
GROUP BY extra
33+
;
34+
```
35+
36+
## Site Solution
37+
38+
```sql
39+
-- LeetCode Solution
40+
SELECT
41+
extra AS report_reason,
42+
COUNT(DISTINCT post_id) AS report_count
43+
FROM Actions
44+
WHERE action_date = '2019-07-04' AND
45+
action = 'report'
46+
GROUP BY report_reason;
47+
```
48+
49+
## Notes
50+
51+
TBD
52+
53+
## NB
54+
55+
TBD
56+
57+
Go to [Index](../?tab=readme-ov-file#index)\
58+
Go to [Overview](../?tab=readme-ov-file)

0 commit comments

Comments
 (0)