SQL Quest › SQL Interview Questions › Subqueries & CTEs

Genres Without Blockbusters

MediumFreeQuerying BasicsSubqueries & CTEs

Write a SQL query to find genres that have no movies with revenue over 500 million. Return the distinct genre names. Use NOT IN with a subquery. Order alphabetically by genre.

Solve it in the browser editor →

Runs on SQLite in your browser, graded against the expected result, no signup. A wrong answer gets a diagnosis, not just "incorrect". Free accounts get 10 free challenge solves, and this can be one of them.

Schema

movies

idtitleyeargenreratingvotesrevenue_millionsruntimedirector
1Guardians of the Galaxy2014Action8.1757074333.13121James Gunn
2Prometheus2012Adventure7485820126.46124Ridley Scott
3Split2016Horror7.3157606138.12117M. Night Shyamalan

Expected output: Genres without any blockbuster (>500M) movies

Hint

First find genres WITH blockbusters using a subquery, then use NOT IN to exclude them

Concepts

SELECT Subquery NOT IN DISTINCT NOT IN / Subquery

Practise the topic: SQL practice questions · CTE practice

Read the concept: SQL CTE tutorial

In these company practice sets

Amazon · Google · Netflix · Snowflake · Spotify

A SQL Quest challenge matched to patterns reported for these companies — not a question any of them has published.

Related questions

UNION ALL Dedup: Cross-Dataset SearchMedium · FreeAbove-Average Departments (Derived Table)Medium · FreeEXISTS vs IN: Departments with Top PerformersMedium · FreeDepartments With High EarnersMedium · FreeHighest Rated by GenreMedium · FreeSimple Subquery: Above AverageMedium · Free

Where would this cost you points in an interview?

Ten questions, no signup: a Skillmap across nine SQL skills and the one to fix first.

Take the readiness test