DataLane

6. Orders with no payment

mediumProNot started~10 minAnti-joins

Asked in screens shaped like: PayPal, Capital One, Stripe

Every order should have a payment row. Find the ones that do not. This is the anti-join interviewers use to see whether you reach for NOT IN, which silently returns nothing when the subquery contains a NULL.

Requirements

  • Columns: order_id, amount
  • Return only orders with no matching payments row
  • Order by order_id
  • Do not use NOT IN

Expected output

order_id, amount

Row order is graded, so ORDER BY matters here.

SQL editor

Loading SQL engine…

Ctrl/Cmd + Enter submits

Run your query to see the result set.

Pro problem

Medium problems unlock with Pro

Easy pads stay free. Medium and hard SQL and Python problems — editor, tests, hints, and solutions — open after you upgrade to Pro or coaching.

See plansPractice free easy problems
↑↓ navigate openesc close