Your question is SQL Print Duplicates. 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.
Write an SQL query to print the duplicates from a table.
Use the client_records table. Treat records with the same non-null account_reference as duplicates. Return every record belonging to a duplicated account reference, excluding null references.
record_id, account_reference, source_system, loaded_at, and duplicate_countaccount_reference ascending, then record_id ascending| Column | Type | Description |
|---|---|---|
| record_idPK | INT | Unique record identifier |
| account_reference | VARCHAR(20) | Reference used to identify an account |
| source_system | VARCHAR(30) | System that supplied the record |
| loaded_at | DATE | Date the record was loaded |