SQL Challenges · WEEKLY QUACK CHALLENGE!

THE MIDNIGHT BUFFET

Difficulty: medium

Chef Shoveler kicks open the pantry door, apron dusted white. Forty ducks arrive at midnight, Duckbert. Weve got enough flour to bury the kitchen and three eggs. THREE. The pancake cook says were practically ready. The cruller cook hasnt 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!

Your 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)

columntype
recipe_idINTEGER
nameVARCHAR

recipe_ingredients (21 rows)

columntype
recipe_idINTEGER
ingredientVARCHAR
amount_per_portionINTEGER

pantry (6 rows)

columntype
ingredientVARCHAR
quantityINTEGER

Database: https://dbquacks.com/data/databases/weekly_202640_14_midnight_buffet.duckdb

This page as markdown: https://dbquacks.com/challenges/weekly/14.md

Play this challenge →