▸_sqlgym

62. Churned Customers (EXCEPT)

MediumSet OperationsEXCEPTanti-joindeduplication

EXCEPT returns rows in the first set that are not in the second ("in A but not B"). It dedupes and compares whole rows, making it a clean way to express set difference.

Task: a customer has churned if they bought last year but not this year. Return the churned customers.

Return a single column customer. Order by customer 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
⌘/Ctrl+↵ run · ⇧⌘/Ctrl+↵ submit
Run a query to see its output here.