SQL Challenges · THE GREAT DUCK MIGRATION!
Cleared for Takeoff
Difficulty: medium
Navigator Neptune drops a faded trophy onto the planning table. Lovely trophy, Duckbert. Can it fly? Neither can a personal best from three years ago! The flight crew needs to be ready NOW. Check each ducks most recent flying competition date and find those who scored at least 90 that day. Sum their identification codes for the takeoff clearance roster!
Your task
Return the sum of SSNs for all ducks whose flying_speed score on their most recent flying_speed competition date is at least 90. Consider all years when finding that date for each duck. Ignore performances in other sports. You will be working with the `duck_athletes` and `performance_records` tables.
Tables
performance_records (800 rows)
| column | type |
|---|---|
duck_id | BIGINT |
sport | VARCHAR |
score | DOUBLE |
competition_date | DATE |
duck_athletes (50 rows)
| column | type |
|---|---|
id | BIGINT |
ssn | BIGINT |
name | VARCHAR |
age | BIGINT |
hometown | VARCHAR |
Database: https://dbquacks.com/data/databases/athletic_champions.duckdb
This page as markdown: https://dbquacks.com/challenges/athletic/40.md