Your question is Identify Duplicate Accounts by Shared Identity Fields. Start with the requirements and the one table on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
You are given account records and asked to identify duplicate accounts using SQL. Return the duplicate groups for shared email values and shared phone_number values, along with the number of accounts in each group and the matching account IDs. Exclude rows where both identity fields are missing, and only return groups with at least two accounts.
| Column | Type | Description |
|---|---|---|
| account_idPK | INT | Primary key for the account |
| VARCHAR(255) | Email address used for login or contact | |
| phone_number | VARCHAR(20) | Phone number used for verification |
| created_at | TIMESTAMP | Account creation timestamp |
| status | VARCHAR(20) | Account status such as active, suspended, or closed |