A social media moderation team is analyzing reports received on a single day. Each row in Actions represents a user's action on a post: view, like, repost, report, or delete. The action type is stored in the ENUM column action. For rows with action = 'report', the report reason is stored in the separate ENUM column report_reason, with these values: spam, racism, violence, nudity, misinformation, other. The action timestamp is stored in acted_at TIMESTAMPTZ, the IP address in INET, and the metadata in JSONB action_payload. For 2024-07-04 in UTC, count the number of distinct posts reported for each report reason. Exclude reasons for which no reports were received that day. Return report_reason and report_count. Sort the result by report_reason.
report_reason is an ENUM, so ORDER BY report_reason sorts values in their declared order (listed above), not alphabetically.
report_reasonreport_countSign in to see submission history
Sign inSign in to use AI Mentor
Sign in