20. Average Views per Video
Solution ↗Tables: video_stats
+-------------------------+-------------+ | Column Name | Type | +-------------------------+-------------+ | video_id | varchar | | view_count | bigint | | like_count | bigint | | comment_count | bigint | +-------------------------+-------------+ video_stats contains performance metrics for each video. video_id is the primary key for this table and references videos.video_id.
Write a SQL query to find the average view_count across all videos in video_stats.
Hint
Tip: Average over video_stats.view_count.
Input:
video_stats table: +----------+------------+------------+---------------+ | video_id | view_count | like_count | comment_count | +----------+------------+------------+---------------+ | V1 | 1500000 | 91000 | 4200 | | V2 | 2500000 | 135000 | 6100 | | V3 | 3000000 | 150000 | 8000 | | V4 | 1000000 | 47000 | 2500 | | V5 | 800000 | 36000 | 1400 | +----------+------------+------------+---------------+
Output:
Output: +---------------------+ | avg_views_per_video | +---------------------+ | 1760000 | +---------------------+
Explanation:
The average is based on all sample video view counts.