Specify a quantified comparison.
Syntax
<in predicate part 2> ::= [ NOT ] IN <in predicate value>
|
| |
( <row value expression> [ { , <row value expression> }... ] ) |
Notes
| ♦ | The degree of the row value predicand, table subquery and row value expressions shall be 1. |
| ♦ | The data types shall be comparable. |
| ♦ | The predicate evaluates to TRUE if the row value predicand has a matching value in the list of values specified by the in predicate value, else to FALSE. |
| ♦ | If the row value predicand is null, then the predicate evaluates to UNKNOWN. |
| ♦ | The NOT operator inverts the meaning of the comparison and is equal to: |
NOT ( <row value predicand> IN <in predicate value> )
Examples
| 1) | The following example selects students from California and New York: |
SELECT studentName, state
FROM students
WHERE state IN ( 'CA', 'NY' )
| 2) | The following examples uses a subquery with the IN predicate to select students who are enrolled in courseID 730: |
SELECT studentID, studentName
FROM students
WHERE studentID IN ( SELECT studentID FROM enrolls WHERE courseID = 730 )
Conformance
|
SQL:2003 standard |
- - |
Core SQL Feature F561 "Full value expressions" |












