Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Find Duplicates With SQL
00:00
5 left

Find Duplicates With SQL

EasySQL · PostgreSQL

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
Interviewer

Your question is Find Duplicates With SQL. Start with the requirements and the one table in the Question tab.

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.
CodePostgreSQL
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.