ARTICLE
WHERE - sql_cond
Short Reference
Syntax
... { {col1 { =|EQ| |NE| |GT|
|LT| =|GE| =|LE }
{ { dobj }
| { col2 }
| { [ALL|ANY|SOME]
subquery } }}
| { col [NOT] BETWEEN dobj1 AND dobj2
}
| { col [NOT] LIKE dobj [ESCAPE esc] }
| { col [NOT] IN (dobj1, dobj2 ...) }
| { col [NOT] IN seltab }
| { col IS [NOT] NULL }
| { (cond_syntax) }
| { [NOT] EXISTS
subquery }
| { col [NOT] IN
subquery } } ... .
Effect
The logical expressions sql_cond in the WHERE condition
are similar to the general logical expressions for
control statements. They consist of relational expressions with
relational operators and with predicate operators. The logical
expressions of a WHERE condition can also be specified
dynamically .
Subqueries can be used too. Multiple
relational expressions of a WHERE condition can be made into one
expression with AND or
OR . A logical expression can be
negated using NOT
Each individual relational expression of the WHERE condition must
always contain at least one column col from one of the database
tables or views listed after FROM as an
operand. The same column names ( comp , dbtab~comp ,
tabalias~comp ) can be specified for col as are in the
list of single columns specified after
SELECT . No aggregate
expressions can be specified and no columns of type STRING ,
RAWSTRING , LCHR , or LRAW .
Note
For frequently used SELECT statements with an identical WHERE
condition, an index should be created. In
WHERE conditions, the fields of the index should be expressed as
equality comparisons and joined with the AND operator. All the
fields of an index that are behind a field, for which a comparison other
than = or EQ is specified in the WHERE clause,
cannot be used for searching in the index.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved