Write a SQL query using DISTINCT to remove duplicates from a dataset.
Return unique combinations of the dataset attributes, excluding the surrogate row identifier. Preserve NULL values as valid attribute values.
source_system, customer_reference, account_type, and statussource_system, customer_reference, account_type, and statussource_system, customer_reference, account_type, and status ascending, with NULL statuses last| Column | Type | Description |
|---|---|---|
| record_idPK | INT | Unique identifier for the stored row |
| source_system | VARCHAR(30) | System that supplied the record |
| customer_reference | VARCHAR(20) | Customer reference in the source data |
| account_type | VARCHAR(30) | Account category recorded in the dataset |
| status | VARCHAR(20) | Current record status, when provided |