Sigmoid's transaction pipelines need a repeatable SQL audit before data is loaded into downstream analytics surfaces. Write a PostgreSQL query that returns every transaction with one or more data quality issues.
customer_id, merchant_id, amount, currency, or status, treating empty customer IDs as missing.(merchant_id, external_transaction_id).2025-01-31, and transaction rows whose merchant does not exist.transaction_id.transaction_id, external_transaction_id, and issue_types.missing_customer_id, missing_merchant_id, missing_amount, missing_currency, missing_status, duplicate_business_key, non_positive_amount, transaction_date_after_cutoff, and unknown_merchant.unknown_merchant only when merchant_id is non-NULL and no matching merchant exists.| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Unique transaction row identifier |
| merchant_id | INT | Referenced merchant identifier |
| external_transaction_id | VARCHAR(30) | Source-system transaction key |
| customer_id | VARCHAR(30) | Customer identifier |
| amount | NUMERIC(12,2) | Transaction amount |
| currency | VARCHAR(3) | Currency code |
| transaction_date | DATE | Transaction date |
| status | VARCHAR(20) | Processing status |
| Column | Type | Description |
|---|---|---|
| merchant_idPK | INT | Merchant identifier |
| merchant_name | VARCHAR(100) | Merchant display name |