AnalystPath

Festival Category Wins

SQLMediumMid level~15 min

Problem

A film festival hands out four awards each year. Each award column stores the `director_id` of the winner.

```
Director
+-------------+---------+
| Column | Type |
+-------------+---------+
| director_id | int |
| director | varchar |
+-------------+---------+
director_id is the primary key.

AwardYear
+-------------+------+
| Column | Type |
+-------------+------+
| edition | int |
| best_picture | int |
| best_drama | int |
| best_comedy | int |
| best_short | int |
+-------------+------+
edition is the primary key. Each award column holds the director_id who won that award that edition.
```

Report how many festival awards each director has won. Exclude directors who never won anything.

Return `director_id`, `director`, and `total_wins`, in any order.

Tables

Example rows — the live problem includes the full dataset.

Director
director_iddirector
1Vega
2Romano
3Okafor
AwardYear
editionbest_picturebest_dramabest_comedybest_short
20181111
20191122
20202122

Expected output

Your answer should return 2 rows with the columns director_id, director, total_wins.

Starter code (SQL)

SELECT *
FROM Director;

Solve this SQL question free

Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.

Solution & explanation

Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.

Sign up free to unlock

Related SQL questions