Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Find Duplicates With SQL

EasySQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is Find Duplicates With SQL. Start with the requirements and the one table on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

Nagarro's customer onboarding platform receives customer records from multiple intake sources. Data quality checks must identify email addresses that appear more than once so they can be reviewed before downstream processing.

Write a PostgreSQL query to find duplicate non-null email addresses in the customer_onboarding table.

Requirements

  1. Group records by email and return only email values appearing at least twice.
  2. Return the duplicate email, the number of occurrences, and the earliest created_at value for that email.
  3. Sort by occurrence count descending, then email ascending.

Schema

customer_onboarding
ColumnTypeDescription
record_idPKINTUnique onboarding record identifier
emailVARCHAR(255)Customer email address
full_nameVARCHAR(100)Customer's full name
source_systemVARCHAR(50)System that submitted the record
created_atDATEDate the onboarding record was created
Tablescustomer_onboarding
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results