How do you handle missing data in SQL conceptually?

Quick Overview

Asks how to handle missing data in SQL, from how NULL behaves under three-valued logic to how it affects filters, joins and aggregates. It tests practical judgment about detecting, substituting and imputing missing values without silently losing rows.

How do you handle missing data in SQL conceptually?

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: easy

Interview Round: Other

How do you handle missing data in SQL conceptually? Assume a relational database such as PostgreSQL. ```hint Follow the unknown Think about what a comparison with an unknown value returns, then follow that result through a WHERE clause, a join and an aggregate. ``` ### What a Strong Answer Covers - How SQL represents missing values and how three-valued logic treats comparisons with them. - How NULLs behave in filters, joins, aggregates and grouping, including the places where rows silently disappear. - The options for handling missing values and when each one fits. - Why the meaning and cause of a missing value matter before choosing a fill. ### Follow-up Questions - Why can `NOT IN` with a subquery return no rows, and how would you rewrite it? - How would you forward-fill missing readings in a time series in PostgreSQL? - A column uses -1 and empty strings to mean "missing". How do you clean it? - When is filling with the mean a bad idea, and what would you do instead?

Overview: Asks how to handle missing data in SQL, from how NULL behaves under three-valued logic to how it affects filters, joins and aggregates. It tests practical judgment about detecting, substituting and imputing missing values without silently losing rows.

Nov 25, 2026
easyData ScientistOtherData Manipulation (SQL/Python)
0
0

How do you handle missing data in SQL conceptually? Assume a relational database such as PostgreSQL.

What a Strong Answer Covers Guidance

  • How SQL represents missing values and how three-valued logic treats comparisons with them.
  • How NULLs behave in filters, joins, aggregates and grouping, including the places where rows silently disappear.
  • The options for handling missing values and when each one fits.
  • Why the meaning and cause of a missing value matter before choosing a fill.

Follow-up Questions Guidance

  • Why can NOT IN with a subquery return no rows, and how would you rewrite it?
  • How would you forward-fill missing readings in a time series in PostgreSQL?
  • A column uses -1 and empty strings to mean "missing". How do you clean it?
  • When is filling with the mean a bad idea, and what would you do instead?