Chapter 8 · Window Functions
27. Identify Duplicate Customer Emails
Hard40 XPFinance
The data quality team needs to find duplicate customer emails. Use ROW_NUMBER() partitioned by email and ordered by created_at to assign a sequence number. Return only rows where the row number is greater than 1 (i.e., the duplicates). Show id, first_name, last_name, email, and the row number.
Tables
- PKidINT
- first_nameTEXT
- last_nameTEXT
- emailTEXT
- phoneTEXT
- date_of_birthTEXT
- cityTEXT
- stateTEXT
- countryTEXT
- created_atTIMESTAMP
Need help?
Ask Sol
AI tutor — looks at your current query and nudges you, without spoiling the answer.
Solution
Try the hints first — solving it yourself is what makes it stick.