Previous Topic: Exercise 4-4Next Topic: Exercise 4-5


Using Keywords in Predicates

You have been using comparison operators in predicates to compare one value to another. You can also use keywords in predicates.

Testing for Null Values

You use the keyword IS NULL to retrieve rows for which no value has been stored in the specified column.

How It's Done

The company needs to have a list of employees who do not have a home telephone so that the Human Resources department can get in touch with them by other means in case of emergency.

To retrieve all employees who do not have a telephone, enter:

select emp_id, phone
       from employee
       where phone is null;

The result looks like this:

 EMP_ID    PHONE  ------    -----      2299  <null>      3411  <null>      2010  <null>      3199  <null>      2598  <null>      4008  <null>  6 rows processed