bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/SQL/SQL Tutorial
SQL•SQL Tutorial

SQL NULL Values

Concept visual

SQL NULL Values

Pointer walk
two pointers
leftright102132436485116
left=0
right=6
1
3

Start at both ends

NULL Values

❮ Previous Next ❯

What is a NULL Value?

If a field in a table is optional, it is possible to insert or update a record without adding any value to this field. This way, the field will be saved with a NULL value.

A Null

value represents an unknown, missing, or inapplicable data in a database field. It is not a value itself, but a placeholder to indicate the absence of data.

Note:

A Null

value is different from zero (0) or an empty string (''). A field with a NULL value is one that has been left blank upon record creation.

How to Test for NULL Values?

It is not possible to test for NULL values with comparison operators, such as =, <, or <>. We will have to use the IS NULL and

Is Not Null

operators instead.

IS NULL Syntax

Select

column_names

From

table_name

Where

column_name

IS NULL;

IS NOT NULL Syntax

Select

column_names

From

table_name

Where

column_name

IS NOT NULL;

Demo Database

Below is a selection from the

Customers table used in the examples:

CustomerID

CustomerName

ContactName

Address

City

PostalCode

Country

Previous

SQL INSERT INTO Statement

Next

SQL UPDATE Statement