🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Exercises.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.

Project 22: 4K Video Count

SQL Architect

Builds on these lessons

Query Task

Objective

A CASE WHEN expression can sit right inside an aggregate function — SUM(CASE WHEN ... THEN 1 ELSE 0 END) is the classic pattern for conditionally counting rows within a single aggregate.

You're given a videos table with columns id, title, and quality.

Task: write a query returning a count (as four_k_count) of how many rows have quality equal to '4k'.

query.sql
SELECT SUM(CASE WHEN quality = '4k' THEN 1 ELSE 0 END) AS four_k_count FROM videos;

* Hint: Correct characters turn green, incorrect ones turn red.

Query Results
🗄️

Execute your query to see results