55. Customers With a Big Order (IN vs EXISTS)
MediumSubqueriesINEXISTSsemi-joincorrelated subquery
IN (subquery) and EXISTS (correlated subquery) are two ways to write the same semi-join — "keep an outer row if a related row exists". Both are shown below as separate, verified-equal approaches.
Task: return the names of customers who have placed at least one order of amount greater than 100.
Return a single column name. Order by name ascending.
Tables
Loading schema…
Expected outputrows must come back in this order
Computing expected output…
This is the result for the example data above. On Submit your query is graded against this example plus 4 hidden edge cases — 5test cases in all. A sloppy query that only fits the example won't pass.
SQL· SQLite · runs in your browser
⌘/Ctrl+↵ run · ⇧⌘/Ctrl+↵ submit
Run a query to see its output here.