Your question is Audit CRM Data Quality Flags. Start with the requirements and the three 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.
You are given CRM data used by a large sales team. Write a PostgreSQL query that returns each active account with a data-quality status showing whether it has missing owner assignment, duplicate contacts, or unresolved email conflicts. Focus on surfacing records that need cleanup rather than fixing them.
| Column | Type | Description |
|---|---|---|
| account_idPK | INT | Primary key for the account |
| account_name | VARCHAR(255) | Account name |
| owner_id | INT | Assigned CRM owner |
| is_active | BOOLEAN | Whether the account is active |
| Column | Type | Description |
|---|---|---|
| contact_idPK | INT | Primary key for the contact |
| account_id | INT | Related account |
| VARCHAR(255) | Contact email address | |
| is_primary | BOOLEAN | Primary contact flag |
| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Primary key for the CRM user |
| full_name | VARCHAR(255) | Owner name |