SQL Challenges · WEEKLY QUACK CHALLENGE!
THE RUMOR MILL
Difficulty: hard
Gossip Columnist Garganey slides a notebook across the desk, feathers twitching. A rumor got loose this morning that the mayors bread is gluten-free, Duckbert. By noon the whole pond was honking about it. I have the full whisper log — who told whom, beak to beak. Everyone blames Bertha Blabberbill; she told six ducks herself before breakfast. But her listeners kept their beaks shut! Somewhere in this log a much quieter duck lit the fuse — and every retelling spread it wider. Find the duck whose…
Your task
Each row of `whispers` records one duck telling the rumor to another. A duck's reach is the number of other ducks the rumor reaches through any chain of whispers starting with them — the ducks they told directly, the ducks those ducks told, and so on. Count each reached duck once; the whisper times do not matter. Return the name of the duck with the largest reach; on a tie, the alphabetically first. You will be working with the `whispers` and `ducks` tables.
Tables
whispers (21 rows)
| column | type |
|---|---|
whisper_id | INTEGER |
teller_id | INTEGER |
listener_id | INTEGER |
whispered_at | TIMESTAMP |
ducks (23 rows)
| column | type |
|---|---|
duck_id | INTEGER |
name | VARCHAR |
Database: https://dbquacks.com/data/databases/weekly_202639_13_rumor_mill.duckdb
This page as markdown: https://dbquacks.com/challenges/weekly/13.md