How do you use SQL to perform data manipulations in complex queries?
Use the provided tables to produce creator-level performance metrics for videos published in January 2025. Include creators without qualifying videos or views, and classify and rank creators based on their January activity.
Output
- One row per creator, with
creator_id, creator_name, video_count, total_views, total_watch_seconds, avg_watch_seconds, engagement_label, and creator_rank.
- Include all creators, order by
total_watch_seconds descending and creator_id ascending for ties.
Output details
- Restrict
published_at and viewed_at to 2025-01-01 inclusive through 2025-02-01 exclusive.
- Count distinct
video_id values for video_count, and count view records for total_views.
- Treat missing
total_watch_seconds and avg_watch_seconds values as 0.
- Round
avg_watch_seconds to exactly two decimal places.
- Label creators
High for at least 3 views, Low for 1 or 2, and None for 0.
- Assign competition ranks by descending
total_watch_seconds, giving tied creators the same rank and leaving gaps.