Programming · Flashcard

What does the comparison price = NULL evaluate to?

  • AUnknown — comparisons with NULL are never true, so the row is filtered out
  • BTrue for NULL prices — equality is the standard way to test for missing values
  • CFalse for every row — the parser rewrites the comparison to a constant
  • DA syntax error — NULL is a keyword and cannot appear after an operator

Why this is the answer

Any comparison with NULL yields unknown (three-valued logic), and WHERE keeps only true rows — so = NULL matches nothing, even NULL prices. It's not the correct test (that's IS NULL), not a constant-false rewrite, and it parses fine.

Official docs
Study in Gnoseed →