Your question is Find Duplicates Without DISTINCT. 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.
Zebra Technologies receives device inventory data from systems supporting products such as Zebra TC53, TC58, and DS3678 devices. Duplicate imports can distort asset counts and downstream analytics.
Write a PostgreSQL query to find duplicate logical rows in device_inventory_imports without using DISTINCT. Treat rows as duplicates when all business columns match, excluding the surrogate import_id and ingestion timestamp.
device_serial, device_model, firmware_version, warehouse_code, and lifecycle_status.import_id values.| Column | Type | Description |
|---|---|---|
| import_idPK | INTEGER | Unique import record identifier |
| device_serial | VARCHAR(30) | Zebra device serial number |
| device_model | VARCHAR(40) | Device model reported by the source system |
| firmware_version | VARCHAR(20) | Reported firmware version |
| warehouse_code | VARCHAR(10) | Warehouse holding the device |
| lifecycle_status | VARCHAR(20) | Current lifecycle status |
| imported_at | TIMESTAMPTZ | Timestamp when the source row was ingested |