Three-Valued Logic

Learn null in SQL through a few examples using truth tables.

We'll cover the following

Given its relational theory background, SQL comes with a special value that has no counterpart in a common programming language: null. In Python, we have None; in PHP, we have null; in C, we have nil; and about every other programming language has something that looks like a null.

The difference in SQL is that null introduces three-valued logic. This is very different from other languages is that None or Null is used when comparing values. Let’s have a look at the SQL null truth table:

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy