Write a query to identify duplicate student registration records based on name and birthdate, keeping only the earliest registration.
Return only duplicate groups, retaining the earliest record in each group. Treat NULL values as belonging to the same matching group.
student_name, birth_date, registration_id, registered_at, and duplicate_countstudent_name, birth_date, registered_at, and registration_id, with NULL names and birthdates last| Column | Type | Description |
|---|---|---|
| registration_idPK | INT | Unique registration record identifier |
| student_name | VARCHAR(150) | Student's full name |
| birth_date | DATE | Student's date of birth |
| registered_at | TIMESTAMP | Timestamp when the registration was created |