WITH ranked_videos AS (
SELECT
video_title,
category,
views,
ROW_NUMBER() OVER (
PARTITION BY category
ORDER BY views DESC
) AS rn
FROM videos
)
SELECT
video_title,
category,
views
FROM ranked_videos
WHERE rn = 1;💡 Example 4: Calculate Channel Performance
SELECT
c.channel_name,
COUNT(v.video_id) AS total_videos,
SUM(v.views) AS total_views,
SUM(v.likes) AS total_likes,
SUM(v.comments) AS total_comments
FROM channels c
LEFT JOIN videos v
ON c.channel_id = v.channel_id
GROUP BY c.channel_name
ORDER BY total_views DESC;
💡 Example 5: Analyze Publishing Performance
SELECT
EXTRACT(DOW FROM publish_date) AS day_of_week,
COUNT(*) AS total_videos,
ROUND(AVG(views), 0) AS avg_views
FROM videos
GROUP BY EXTRACT(DOW FROM publish_date)
ORDER BY avg_views DESC;
💡 Example 6: Rank Videos by Views
SELECT
video_title,
views,
DENSE_RANK() OVER (
ORDER BY views DESC
) AS view_rank
FROM videos;
🎯 Key Insights You Can Derive
🔹 Which videos generate the most views?
🔹 Which content categories perform best?
🔹 Which videos have high engagement but relatively low views?
🔹 What publishing days generate the most views?
🔹 Which channels have the strongest audience engagement?
🔹 Which content contributes most to subscriber growth?
🔹 Which videos should be promoted further?
💼 This project is especially useful for Data Analysts, Product Analysts, Growth Analysts, Marketing Analysts, and Business Intelligence professionals working with content, media, and digital platforms.
Double Tap ❤️ For More