Solution: 41. Categorize Channels by Subscriber Size
Hard
Problem Detail:
Write a SQL query to categorize each channel into one of these groups based on subscriber_count: Mega for 10,000,000 and above, Large for 1,000,000 to 9,999,999, Medium for 100,000 to 999,999, and Small for below 100,000.
Answer SQL Query:
SELECT channel_name,
subscriber_count,
CASE
WHEN subscriber_count >= 10000000 THEN 'Mega'
WHEN subscriber_count >= 1000000 THEN 'Large'
WHEN subscriber_count >= 100000 THEN 'Medium'
ELSE 'Small'
END AS channel_size
FROM channels;
You can easily copy this solution, switch back to your editor tab, paste it, and run the SQL!