IMY Learning
Back to Questions

40. Channels with No Videos in the Dataset

Solution ↗
Medium
Tables: channels, videos
+-------------------------+-------------+
| Column Name             | Type        |
+-------------------------+-------------+
| channel_id              | varchar     |
| channel_name            | varchar     |
| subscriber_count        | bigint      |
| view_count              | bigint      |
+-------------------------+-------------+
channels contains one row per YouTube channel.
channel_id is the primary key for this table.
+-------------------------+-------------+
| 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 find channels that do not have any matching records in the videos table.
Hint
Tip: LEFT JOIN plus NULL filter reveals missing matches.
Input:
channels table:
+------------+------------------+------------------+------------+
| channel_id | channel_name     | subscriber_count | view_count |
+------------+------------------+------------------+------------+
| C101       | Alpha Tech       | 2500000          | 92000000   |
| C102       | Data With Mira   | 1800000          | 71000000   |
| C103       | SQL Zone         | 950000           | 40000000   |
+------------+------------------+------------------+------------+

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:
+------------+--------------+
| channel_id | channel_name |
+------------+--------------+
|            |              |
+------------+--------------+
Explanation:

If every channel has videos in the dataset, the result can be empty.

SQL Editor
Click "Run SQL" to execute the query and see results here.
About Us Contact Us Privacy Policy Terms & Conditions
© 2026 IMY Learning. All rights reserved.