SQL Practice Logo

SQLPractice Online

Scenario SQL Question

Find Duplicate Rows Using CTE (Common Table Expression)

Build mastery in Finding Duplicates with this scenario-based SQL challenge and live execution support.

Problem Statement

Use a WITH-CTE plus ROW_NUMBER to flag duplicate (first_name, last_name, email) records. Return employee_id, first_name, last_name, email, rn — but ONLY rows with rn > 1 (i.e. the duplicates beyond the first occurrence). Order by employee_id ascending.

Relevant Tables

employees

SQL Concepts Used in This Scenario

Strengthen your understanding with these targeted learning topics: