26. Count Videos by Live Broadcast Content
Solution ↗Tables: videos
+-------------------------+-------------+ | Column Name | Type | +-------------------------+-------------+ | video_id | varchar | | channel_id | varchar | | title | varchar | | published_at | datetime | +-------------------------+-------------+ videos contains one row per video. video_id is the primary key for this table. channel_id is a foreign key referencing channels.channel_id.
Write a SQL query to count videos by live_broadcast_content.
Hint
Tip: Aggregate by live_broadcast_content.
Input:
videos table: +----------+------------+-------------------+---------------------+ | video_id | channel_id | title | published_at | +----------+------------+-------------------+---------------------+ | V1 | C101 | Python Basics | 2024-01-11 10:00:00 | | V2 | C101 | Tableau Project | 2024-03-05 10:00:00 | | V3 | C102 | SQL Joins | 2024-04-10 09:00:00 | | V4 | C102 | Window Functions | 2024-05-01 09:00:00 | | V5 | C103 | Intro to MySQL | 2024-02-07 11:30:00 | +----------+------------+-------------------+---------------------+
Output:
Output: +------------------------+--------------+ | live_broadcast_content | total_videos | +------------------------+--------------+ | none | 5 | +------------------------+--------------+
Explanation:
This shows how many videos fall into each broadcast type.