Routine~13min
The Duplicate Invoice
Accounts payable got a call from a vendor asking why they hadn't been paid. When the team dug in, they found the same invoice number submitted twice — once marked paid, once pending. Three vendors did this; six duplicate pairs in total. The system had no unique constraint on (vendor_id, invoice_number).
Tables you'll query
vendorsinvoices
What you'll learn
Aggregations & GROUP BYSELECT & Filtering