Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Handling Duplicates and Nulls in SQL

EasySQL & Data Manipulation00:00
I
Practice interviewer
Your interviewer
In session
I
Interviewer

Welcome to your interview.

The question is on your right: Handling Duplicates and Nulls in SQL. Take a moment with it first.

Talk your thinking through with me if you like - when you're confident, submit your answer and I'll grade it like a real screen (7/10 or better passes). Discussion and graded submissions share your five interviewer interactions, so spend them well.

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

Problem

Context

Data quality issues often show up as duplicate rows and missing values. In analytics and operational systems, both can distort counts, aggregations, and downstream reporting if they are not handled carefully.

Question

Explain how you would handle duplicate records and NULL values in a dataset using SQL. Your answer should cover:

  1. How to identify duplicates
  2. How to remove or retain the correct record when duplicates exist
  3. How NULL values affect filtering, grouping, and aggregations
  4. Common SQL techniques for replacing, excluding, or preserving NULLs depending on the use case

Scope Guidance

The interviewer expects a practical explanation, not just definitions. Discuss the trade-offs between deleting data, deduplicating in queries, and preventing bad data at ingestion. Use simple SQL examples and mention common mistakes, especially around COUNT, GROUP BY, and comparisons with NULL.