SQL Practice Logo

SQLPractice Online

Scenario SQL Question

Identify Records for Deletion (Keep Oldest, Delete Newest)

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

Problem Statement

List duplicate records that should be DELETED to enforce 'one row per email'. Keep the smallest employee_id; mark the rest for deletion. Return employee_id, email, first_name, last_name, action (the literal 'DELETE - Duplicate'), ordered by email then employee_id ascending.

Relevant Tables

employees

SQL Concepts Used in This Scenario

Strengthen your understanding with these targeted learning topics: