Skip to main content
All Problems
medium0% acceptance

Customer Pairs in the Same City

The networking team wants to find pairs of customers who live in the same city. Return customer1_name (first_name || ' ' || last_name), customer2_name, and city. Ensure each pair appears only once (customer1 id < customer2 id). Sort by city, then customer1_name. Limit to 50.

Schema

🔑idINT
first_nameTEXT
last_nameTEXT
emailTEXT
phoneTEXTNULL
date_of_birthTEXT
cityTEXT
stateTEXT
countryTEXT
created_atTIMESTAMP
postgresql

Run your query to see results

Press Ctrl + Enter to execute