InterBase Quick Start: Part IV - Testing for an Unknown Value
From InterBase
Go Up to InterBase Quick Start: Part IV - Using the WHERE Clause
Another type of comparison tests for the absence or presence of a value. Use the IS NULL
operator to test whether a value is unknown. To test for the presence of any value, use IS NOT NULL
.
Testing for NULL
- Execute the following query to retrieve the names of employees who do not have phone extensions:
SELECT last_name, first_name, phone_ext FROM Employee WHERE phone_ext IS NULL
The image below shows the expected result:
- Now execute the statement using
IS NOT NULL
to retrieve the names of employees who do have phone extensions:SELECT last_name, first_name, phone_ext FROM Employee WHERE phone_ext IS NOT NULL
The image below shows the expected result: