Simple Predicates

Predicates using the following operators in their selection conditions are called simplepredicates:

Operator Evaluated as
= equal to
<> not equal to
!= not equal to
^= not equal to
> greater than
>= greater than or equal to
!> not greater than
< less than
<= less than or equal to
!< not less than

The following query displays all rows in the SUPPLIER table containing a value of 20 in their STATUS column:

SELECT *
  FROM supplier
  WHERE status = 20

The query results appear below:

sno sname status city
S1 SMITH 20 LONDON
S4 CLARK 20 LONDON

The WHERE clause in the next example compares a character string "PARIS" with the CITY column. The query below retrieves SNO (supplier number) and STATUS column data for all suppliers in Paris:

SELECT sno, status
  FROM supplier
  WHERE city = "PARIS"

Note that character strings can be enclosed in either double (") or single (') quotes. The display result appears below:

sno status
S2 10
S3 30

When one column value is compared against another column value in a query -- and the column data types are different, the XDB Server tries to convert one of the data values to a data type compatible with the other data value before performing the comparison. For example, if integer and float column values are compared, the INT data value is converted to a FLOAT value before the XDB Server performs the comparison.

Spaces in data values are considered when evaluating retrieval conditions. Right justified data with leading spaces does not equal left justified data with trailing spaces. For example, the string "Jones" is read as a completely different value, depending on the number of preceding or trailing blank spaces attached. The LIKE predicate operator (see the LIKE Operator) allows string pattern matching without strict adherence to character string content and order.

All three of the < > or ! = or ^ = predicate operators specify records for retrieval that do not meet the specified condition. For example, the following query retrieves the PNO (part number) column values of all PART table records with a COLOR column value other than "RED."

SELECT pno
  FROM part
  WHERE color != "RED"