IN Predicate

From Recital Documentation Wiki
Revision as of 15:28, 13 March 2009 by Yvonnemilne (Talk | contribs)

Jump to: navigation, search

IN PREDICATE

Class

SQL Applications


Purpose

Special predicate


Syntax

<expression> [NOT] IN (<value list>) <expression> [NOT] IN (<nested select>)


See Also

PREDICATES, INSERT, SELECT, UPDATE


Description

IN is a special predicate to evaluate whether the specified <expression> is equal to one of the values in the <value list> or <nested select>. The <value list> contains a list of comma separated values. The <nested select> is an SQL SELECT clause.

The optional NOT evaluates whether the specified <expression> is not equal to any of the values in the <value list> or <nested select>.

The data type must be the same for the <expression> and all the values in <value list> or returned by the <nested select>.


Example

EXEC SQL
SELECT name, address, balance, cost*1.15
FROM accounts
WHERE paid_date < date() AND ord_value IN (100, 200, 300)
ORDER BY name, paid_date;
 
EXEC SQL
SELECT name, address, balance, rep_id
FROM accounts
WHERE rep_id IN (SELECT emp_id from employees where location = ’MA’)
ORDER BY name;


Products

Recital Database Server, Recital Mirage Server, Recital Terminal Developer