Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Handling Duplicates and Nulls in SQL

EasySQL & Data Manipulation00:00
Practice interviewer
In session
5 left
00:00

Your question is Handling Duplicates and Nulls in SQL. Take a moment with it on the right.

Talk me through your thinking if you like. When you're confident, submit your answer and I'll grade it like a real screen (7/10 or better passes).

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.