SQL Interview: 75 Boolean logic with NULLs

SQL Interview: 75 Boolean logic with NULLs

This is a post in the SQL Interview series. These aren’t trick or gotcha questions, they’re just questions designed to scope out a candidate’s knowledge around SQL Server and Azure SQL Database.

Section: Development Level: Intro

Question:

In the following WHERE clause, both AColumn and AnotherColumn are NULL.

WHERE AColumn = AnotherColumn

What is the effect of the WHERE clause?

Answer:

In SQL boolean logic, the expression NULL = NULL returns NULL and not True. So the WHERE clause would exclude the rows.

2025-09-01