1Z0-909 · Question #34
Which select statement returns true?
The correct answer is B. SELECT NULL <=> NULL. Option B uses MySQL's NULL-safe equality operator (<=>), which is specifically designed to treat NULL <=> NULL as TRUE - unlike standard SQL operators, it handles NULL as a comparable value rather than an unknown. Options A and C use standard comparison operators (<> and =)…
Question
Which select statement returns true?
Options
- ASELECT NULL <> NULL;
- BSELECT NULL <=> NULL;
- CSELECT NULL = NULL;
- DSELECT NULL := NULL;
How the community answered
(34 responses)- A3% (1)
- B94% (32)
- C3% (1)
Explanation
Option B uses MySQL's NULL-safe equality operator (<=>), which is specifically designed to treat NULL <=> NULL as TRUE - unlike standard SQL operators, it handles NULL as a comparable value rather than an unknown.
Options A and C use standard comparison operators (<> and =), which always return NULL (not TRUE or FALSE) when either operand is NULL, because NULL represents an unknown value and any comparison with an unknown is itself unknown. Option D (NULL := NULL) uses the assignment operator, not a comparison operator at all - it assigns a value and doesn't return a boolean result in a SELECT context.
Memory tip: Think of <=> as the "spaceship operator" - it's built to bridge the gap that normal operators can't cross. If you see <=>, it's the only one that can safely land on NULL.
Topics
Community Discussion
No community discussion yet for this question.