# Water Specialists Identification

THE GREAT DUCK MIGRATION! · challenge 29 · medium

> Scout Samantha returns from reconnaissance with urgent news. "The migration route crosses three major rivers this year! We need to identify our natural water specialists - ducks who perform better in swimming than in flying_speed. These athletes will lead river crossings and assist weaker swimmers. Compare each duck's swimming average to their flying_speed average and find those with a natural aquatic advantage!"

## Task

Return the sum of SSNs for all ducks whose career average score in swimming is higher than their career average score in flying_speed. Only include ducks who have competed in both sports. You will be working with `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 |

## Data

The tables live in a DuckDB database: https://dbquacks.com/data/databases/athletic_champions.duckdb

To query it outside the browser, attach it read-only:

```sql
ATTACH 'https://dbquacks.com/data/databases/athletic_champions.duckdb' AS db (READ_ONLY);
USE db;
```

Play it in the browser: https://dbquacks.com/challenges/athletic/29

## Answer

The expected answer is not published. Submit on the page to have it checked.
