Explain how you would approach data clearing and modeling for a reality-based problem scenario.
Using the provided tables, write a PostgreSQL query that excludes invalid records, resolves related creator and event information, and summarizes valid activity. Treat records with missing required identifiers or timestamps, negative watch time, inactive event types, or unmatched references as invalid. Do not exclude valid events solely because watch time is NULL.
Output
- One row per creator and active event category.
- Return
creator_id, creator_name, event_category, event_count, total_watch_seconds, and category_rank.
- Rank categories within each creator by total watch time descending, with ties sharing a rank. Sort by
creator_id, category_rank, and event_category.