Skip to content

Commit ab194a8

Browse files
authored
Create reported-posts-ii.sql
1 parent 33106f3 commit ab194a8

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

MySQL/reported-posts-ii.sql

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Time: O(m + n)
2+
# Space: O(n)
3+
4+
SELECT ROUND(AVG(removal_percent), 2) average_daily_percent
5+
FROM
6+
(SELECT a.action_date,
7+
COUNT(DISTINCT r.post_id) / COUNT(DISTINCT a.post_id) * 100 removal_percent
8+
FROM Actions a
9+
LEFT JOIN Removals r ON a.post_id = r.post_id
10+
WHERE a.extra = 'spam'
11+
GROUP BY a.action_date
12+
ORDER BY NULL) tmp

0 commit comments

Comments
 (0)