Delete Duplicate Records in Employees Table
Delete duplicate records while keeping the record with the smallest ID.
sql
DELETE e1 FROM employees e1 INNER JOIN employees e2 WHERE e1.id > e2.id AND e1.email = e2.email;
This query performs a self-join on the "employees" table to identify rows that share the same "email" address, deleting those where the "id" is greater than the minimum "id" found for that specific email.
PromptDB can make mistakes. Please double-check responses.