Multiple choice technology databases

When SET ANSI_NULLS is OFF then which one is true?

  1. A SELECT statement that uses WHERE column_name = NULL returns no results

  2. A SELECT statement that uses WHERE column_name = NULL returns the rows that have null values in column_name.

  3. A SELECT statement that uses WHERE column_name = NULL will throw error.

  4. A SELECT statement that uses WHERE column_name = NULL returns all the rows.

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

When SET ANSI_NULLS is OFF, the SQL standard behavior is overridden, and comparison operators like = against NULL evaluate to true for rows containing nulls. Thus, column_name = NULL successfully retrieves rows with null values, instead of returning empty results or throwing errors.