1.0

Table Of Contents
SyntaxExplanation and ExampleOperator
|HotelBookings WHERE
rooms_available = 0)
Expression
[ NOT ]
IN (
Expression
[,
Expression
]* )
}
[NOT] EXISTS
TableSubquery
Operates on a table subquery. Returns TRUE if the table
subquery returns any rows, and FALSE if it returns no rows.
Table subquery can return multiple columns (only if you use
* to denote multiple columns) and rows.
WHERE EXISTS
EXISTS
(SELECT *
FROM Flights
WHERE dest_airport = 'SFO'
AND orig_airport = 'GRU')
A quantied comparison is a comparison operator (<, =, >,
<=, >=, <>) with ALL or ANY or SOME applied.
Operates on table subqueries, which can return multiple rows
but must return a single column.
Quantied comparison
Expression
If ALL is used, the comparison must be true for all values
returned by the table subquery. If ANY or SOME is used, the
ComparisonOperator
{
ALL |
comparison must be true for at least one value of the table
subquery. ANY and SOME are equivalent.
WHERE normal_rate < ALL
(SELECT budget/550 FROM Groups)
ANY |
SOME
}
TableSubquery
Dynamic Parameters
You can prepare statements that are allowed to have parameters for which the value is not specied when the
statement is prepared by using PreparedStatement methods in the JDBC API.
These parameters are called dynamic parameters and are represented by a ?.
The JDBC API documents refer to dynamic parameters as IN, INOUT, or OUT parameters. In SQL, they are
always IN parameters. You must specify values for them before executing the statement. The values specied
must match the types expected.
Dynamic parameters example
PreparedStatement ps2 = conn.prepareStatement(
"UPDATE HotelAvailability SET rooms_available = " +
503
SQL Language Reference