# DUCK ELECTION NIGHT

WEEKLY QUACK CHALLENGE! · challenge 6 · medium · 5 guesses

> News Anchor Eider jabs a wing at the precinct map. "Bill Duckson is already honking his victory speech — he piled up the most votes, no argument. But look at the map, Duckbert: he ran up the score in a few packed ponds and got out-paddled everywhere else. The night belongs to whoever carried the most precincts — pond by pond, race by race. Raw totals won't tell you. Find me the duck who won the map!"

## Task

A precinct is carried by the candidate with the most votes in that precinct. Return the name of the candidate who carries the most precincts; on a tie, the alphabetically first. You will be working with the `votes` and `candidates` tables.

## Tables

### `votes` (27 rows)

| column | type |
| --- | --- |
| precinct_id | INTEGER |
| candidate_id | INTEGER |
| count | INTEGER |

### `candidates` (3 rows)

| column | type |
| --- | --- |
| candidate_id | INTEGER |
| name | VARCHAR |

## Data

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

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

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

Play it in the browser: https://dbquacks.com/challenges/weekly/6

## Answer

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