The order card pulls in its payments. There is one order with a handful of payments — and the payments table is read whole. Here is a foreign key without an index again. Build the road from the order to its payments.
SELECT p.* FROM payments p WHERE p.order_id = 77123
You may only change the schema: indexes and ANALYZE. The query stays as the task wrote it — no need to send it back.
Grading runs on a larger dataset than the samples show — the answer has to hold at scale.
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign in