Every Anchor Buyer Also Bought This
Hard About 30 min Katabench Pro
Use relational division to find products shared by every buyer of a dynamic anchor product.
The full brief is part of Katabench Pro
Pro opens this kata's brief, its starter code and its grader. To see how the track works first, try Customer Order Totals, which is free.
How it is graded
Your LINQ or SQL runs against real PostgreSQL. You see the SQL your code generates on the sample tests and can inspect its execution plan, so you learn when the database did the wrong work.
What it practices
- Relational division
- Find rows related to every member of a set, not just some of them.
Do these first
Related katas
- Whose Basket Is a Proper Subset? Hard Pro Compare dynamic distinct purchase sets with nested existence checks and return every proper customer-set containment relation.
- The Same Basket in Different Lines Hard Pro Compare order baskets as product-to-total-quantity multisets, independent of line splitting, prices, totals, and row order.
- Bought Every Show in a Genre Hard Pro Relational division: find the rows that match every member of a set, not just one of them.
- Customer Order Totals Medium Free Sum each customer's orders with a single SQL query instead of an N+1 loop.