Find the price effective on each order date Original fictional practice data · 2026-11-11 · CC BY 4.0 BRIEF Sales operations must verify historical prices. Pick the last price that started on or before each order date, without leaking a future price into an older sale. CONTRACT 1. Effective start dates are inclusive and unique per SKU. A price remains valid until a later start. 2. If no price existed on the order date, return NULL for unit_cents and line_cents. Keep the order. 3. Return order_id,unit_cents,line_cents sorted by order_id. METHOD Match a price only when its start date is not after the order date. Select the greatest eligible start per order, rather than the greatest price value. Keep H3 and H5 as missing-price exceptions and never fill them with zero. COMMON MISTAKE Looking up only SKU applies today’s price to all orders. Sorting by price instead of effective date fails when a later price decreases. INDEPENDENT CROSS-CHECK Three priced orders total 14,800 cents. Two orders require historical-price review. DELIVER A checked output CSV and a handoff note explaining the exception policy. Use setup.sql in SQLite or import each table CSV into your spreadsheet. expected.csv is the complete reference result; an empty CSV field represents SQL NULL. The browser executes SQLite, not Excel formulas. XLOOKUP is unavailable in Excel 2016 and 2019. Sources for function behavior: https://www.sqlite.org/lang_select.html and https://support.microsoft.com/en-us/excel/functions/xlookup-function (checked 2026-11-11). Rates, dates and policies here are exercise assumptions.