Identify Duplicate Employee Name and Department

Find duplicate employee records based on name and department.

sql

SELECT name, department, COUNT(*) FROM employees GROUP BY name, department HAVING COUNT(*) > 1;

This query groups the records by "name" and "department" and uses the HAVING clause to filter for groups that appear more than once, effectively identifying the duplicate entries.

PromptDB can make mistakes. Please double-check responses.