SQL Challenges · WEEKLY QUACK CHALLENGE!

THE BAKER'S DOZEN

Difficulty: medium

Baker Sheldrake peers over the pastry counter at Duckbert. We sold a mountain of biscuits — but which item actually raked in the most bread? Quantity fools the eye, Duckbert. Find the item with the highest revenue that isnt our unit king.

Your task

Each item’s revenue is its total quantity sold times its price. Among all items that are NOT the single best-seller by total quantity sold, return the name of the one with the highest revenue. On a revenue tie, return the alphabetically first. You will be working with the `order_items` and `items` tables.

Tables

order_items (26 rows)

columntype
order_idINTEGER
item_idINTEGER
qtyINTEGER

items (6 rows)

columntype
item_idINTEGER
nameVARCHAR
priceDECIMAL(6,2)

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

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

Play this challenge →