Without SQL, sort by the natural key (email, order_id, device_id) and look for adjacent identical keys. For composite keys, concatenate in a scratch column or sort by multiple columns.
Limits
- Case sensitivity can hide dupes, normalize case upstream.
- Trailing spaces break key equality.