+---------------+---------+
| Column Name | Type |
+---------------+---------+
| user_id | int |
| post_id | int |
| action_date | date |
| action | enum |
| extra | varchar |
+---------------+---------+
This table may have duplicate rows.
The action column is an ENUM (category) type of ('view', 'like', 'reaction', 'comment', 'report', 'share').
The extra column has optional information about the action, such as a reason for the report or a type of reaction.
extra is never NULL.
Write a solution to report the number of posts reported yesterday for each report reason. Assume today is 2019-07-05.
We need to count, for each report reason, how many posts were reported yesterday (2019-07-04). Only rows with action = ‘report’ and action_date = ‘2019-07-04’ matter. The ’extra’ column contains the report reason.