Progress
Embedded SQL-92
Guide and Reference


NULL Values in the WHERE Clause

A select operation succeeds if the search condition in the WHERE clause evaluates to TRUE. A row is not selected if the search condition evaluates to FALSE or is unknown.

EXAMPLE

In the following example, if commission is NULL for empno 2004, the search condition is not satisfied:

WHERE ((sal + commission) < 5000)
     AND empno = 2004 ; 

The search condition with an OR evaluates to TRUE:

WHERE ((sal + commission) < 5000)
     OR empno = 2004 ; 

You can select or reject a row containing NULL values in a column by using the [NOT] NULL search condition:

... WHERE commission IS NOT NULL ;
... WHERE commission IS NULL ; 

EXAMPLE

The following example shows how to select employee names and department numbers for employees who have not been assigned to any project:

EXEC SQL
     SELECT ename, deptno
     FROM employee
     WHERE projno IS NULL ; 

You perform a join between two tables using a WHERE clause. Rows do not meet the search criteria if either the salary column in either table is NULL or if the salary columns in both tables are NULL:

WHERE employee.salary = title.salary ; 


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095