Your question is Detect Duplicates in Database. Start with the requirements and the two tables 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.
FanDuel needs a data-quality query to identify player records that may represent the same person. Records should be considered potential duplicates when they share a non-empty normalized email address or a normalized phone number.
Write a PostgreSQL query that returns each duplicate player pair and the source systems associated with both records.
| Column | Type | Description |
|---|---|---|
| player_idPK | INTEGER | Unique player record identifier |
| full_name | VARCHAR(100) | Player's full name |
| VARCHAR(255) | Registered email address | |
| phone | VARCHAR(30) | Registered phone number, possibly formatted differently across sources |
| Column | Type | Description |
|---|---|---|
| player_id | INTEGER | Player record identifier |
| source_name | VARCHAR(50) | System that created or supplied the player record |