Pairs of Customers in the Same Country (Self-Join)

easy
Unit 8 · Filtering & Joins0/3 to milestone

Return every pair of different customers from the same country: customer_a, customer_b and country. List each pair once, with customer_a being the one with the lower id. Sort by country, then customer_a, then customer_b.

Schema

customers(id, name, country, signup_date)
orders(id, customer_id, order_date, total)
#self-join#joins1 visible + 2 hidden tests
query.sql · SQLite
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Pairs of Customers in the Same Country (Self-Join) · TechGradify