# THE MIDNIGHT BUFFET

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

> Chef Shoveler kicks open the pantry door, apron dusted white. "Forty ducks arrive at midnight, Duckbert. We've got enough flour to bury the kitchen and three eggs. THREE. The pancake cook says we're practically ready. The cruller cook hasn't checked the honey shelf. I need one dish we can actually serve to this flock, with every ingredient accounted for. Find the dish that makes the most complete portions before somebody starts eating the menu!"

## Task

Return the name of the dish that can make the most whole portions using the pantry stock. Every portion needs all the ingredients and amounts listed for its recipe. An ingredient missing from `pantry` has zero stock. On a tie, return the alphabetically first dish name. You will be working with the `recipes`, `recipe_ingredients`, and `pantry` tables.

## Tables

### `recipes` (9 rows)

| column | type |
| --- | --- |
| recipe_id | INTEGER |
| name | VARCHAR |

### `recipe_ingredients` (21 rows)

| column | type |
| --- | --- |
| recipe_id | INTEGER |
| ingredient | VARCHAR |
| amount_per_portion | INTEGER |

### `pantry` (6 rows)

| column | type |
| --- | --- |
| ingredient | VARCHAR |
| quantity | INTEGER |

## Data

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

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

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

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

## Answer

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