IBM Books

SQL Reference

Basic Predicate

>>-expression----+- = --------+-----expression-----------------><
                 |      (1)   |
                 +- <> -------+
                 +- < --------+
                 +- > --------+
                 |      (1)   |
                 +- <= -------+
                 |      (1)   |
                 '- >= -------'
 

Notes:

  1. Other comparison operators are also supported 34

A basic predicate compares two values.

If the value of either operand is null, the result of the predicate is unknown. Otherwise the result is either true or false.

For values x and y:

Predicate
Is True If and Only If...
x = y
x is equal to y
x <> y
x is not equal to y
x < y
x is less than y
x > y
x is greater than y
x >= y
x is greater than or equal to y
x <= y
x is less than or equal to y

Examples:

   EMPNO='528671'  
   SALARY < 20000 
   PRSTAFF <> :VAR1
   SALARY > (SELECT AVG(SALARY) FROM EMPLOYEE)


Footnotes:

34
The following forms of the comparison operators are also supported in basic and quantified predicates; ^=, ^<, ^>, !=, !< and !>. In addition, in code pages 437, 819, and 850, the forms ¬=, ¬<, and ¬> are supported.

All these product-specific forms of the comparison operators are intended only to support existing SQL that uses these operators, and are not recommended for use when writing new SQL statements.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]