Write a query to identify duplicate user registrations by analyzing timestamps and email variations at Credit Karma. Treat emails as equivalent when comparison is case-insensitive, surrounding whitespace is ignored, periods are removed from the local part, and plus-tags are removed. A registration is a duplicate when the previous equivalent registration occurred within 24 hours.
registration_id, user_id, email, registered_at, previous_registration_id, and hours_since_previousregistered_at, and registration_id| Column | Type | Description |
|---|---|---|
| registration_idPK | INT | Unique registration identifier |
| user_id | INT | Identifier assigned to the registered user |
| VARCHAR(255) | Email supplied during registration | |
| registered_at | TIMESTAMPTZ | Timestamp when the registration was created |