Skip to content

varshanookarapu/Youtube_Analytics_SQL_Challenge

Repository files navigation

📊 SQL Practice Questions – Video Analytics Dataset

This repository contains SQL practice questions covering basic queries, aggregations, joins, window functions, and advanced analytics using a video analytics dataset.

I put the dataset code in this file Youtube Analytics Dataset which you can copy paste in DB fiddle (https://www.db-fiddle.com/) and work on these challenges . You can intially test the data set by using the following queries

SELECT * FROM Youtube.creators LIMIT 2;
SELECT * FROM Youtube.videos LIMIT 2;
SELECT * FROM Youtube.daily_views LIMIT 2;
SELECT * FROM Youtube.comments LIMIT 2;
SELECT * FROM Youtube.likes_dislikes LIMIT 2;
SELECT * FROM Youtube.revenue LIMIT 2

🚀 Purpose

This dataset is designed to practice:

  • SQL Joins
  • Aggregations
  • Window Functions
  • Real-world analytics scenarios
  • Data quality checks

  1. List all videos and their creator names.
  2. Count total videos per creator.
  3. Get total comments for a given video.
  4. List videos published in the last 18 months.
  5. Find videos longer than 20 minutes.
  6. Show top 10 videos by total views (aggregate daily_views).
  7. Show unique categories.
  8. Count creators per country.
  9. Get average views per video per creator.
  10. Find videos with zero comments.

  1. Total impressions and clicks per video.
  2. Compute CTR = clicks / impressions per day.
  3. Average watch time per view (watch_time_seconds / views).
  4. Daily views trend for a single video.
  5. Views per category.
  6. Top 5 videos by watch_time_seconds.
  7. Average likes/dislikes per video.
  8. List videos with more dislikes than likes.
  9. Videos where avg_view_duration < 20% of duration.
  10. Videos that gained more than 1k views in a day (spikes).

  1. For each creator, total revenue (ad + subscription + other).
  2. For each video, last 7-day rolling average views.
  3. Top performing video per creator by revenue.
  4. Video comment sentiment breakdown (positive / neutral / negative).
  5. Videos with impressions but 0 clicks (possible data issue).
  6. List videos and their peak daily views date.
  7. Show creators who published more than 10 videos.
  8. Videos with multiple high-spike days.
  9. Find videos with payments revenue but zero views (data mismatch).
  10. Creator-wise average CTR.

  1. Rank videos by total views within each category (RANK / DENSE_RANK).
  2. Running total of views per video (window function).
  3. Monthly growth rate of views for each video (LAG).
  4. Top 3 videos per month (partition + ranking).
  5. Percentile of views for each video (NTILE).
  6. Lead/Lag to calculate day-over-day % change.
  7. Cumulative watch time per creator.
  8. Rank creators by average watch time per video.
  9. Use ROW_NUMBER to deduplicate and get latest daily stats.

🔴 Advanced / Analytics (40–50)

  1. Compute engagement score = (likes + comments + clicks) / impressions.
  2. Detect anomaly days using z-score on daily views.
  3. Creator retention: % of videos still getting views after 90 days.
  4. Find videos causing highest drop-off (low avg_view_duration vs duration).
  5. Creator lifetime value = total revenue / number of videos.
  6. Segment videos by length and analyze CTR per segment.
  7. Identify top comment contributors.
  8. Videos with >20k impressions but no revenue.
  9. Monthly revenue pivot by category.
  10. Funnel analysis: impressions → clicks → views → watch_time.
  11. Detect inconsistent data across daily metrics tables.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors