## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

## Solution: Use Null as a Unique Value

Most problems with null values are based on a common misunderstanding of the behavior of SQL’s three-valued logic. For programmers accustomed to the conventional true/false logic implemented in most other languages, this can be a challenge. You can handle null values in SQL queries with a little study of how they work.

### Null in Scalar Expressions

Suppose Stan is thirty years old, while Oliver’s age is unknown. If I ask you whether Stan is older than Oliver, your only possible answer is “I don’t know.” If I ask you whether Stan is the same age as Oliver, your answer is also “I don’t know.” If I ask you what is the sum of Stan’s age and Oliver’s age, your answer is the same.

Suppose Charlie’s age is also ...

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required