Company: Meta | Difficulty: easy
A company wants to identify employees whose exact name appears more than once in the employee records.
employees
name
Return each duplicated name once, excluding records where the name is NULL. Sort the duplicate names in descending alphabetical order.
employee_id
department
Chris Cox appears more than once, so it is returned once. The other names appear only once and are excluded.
Chris Cox
DROP TABLE IF EXISTS employees; CREATE TABLE employees ( employee_id INT, name VARCHAR(100), department VARCHAR(80) ); INSERT INTO employees VALUES (1, 'Chris Cox', 'Engineering'), (2, 'Chris Cox', 'Marketing'), (3, 'Sheryl Sandberg', 'Sales'), (4, 'Javier Olivan', 'Finance');
← All SQL Challenges · Meta Questions · Learn SQL Free