Subquery:
prelude to nested query
- Many of the
tuple condition
clauses uses:
Examples:
attr IN ( set of values )
attr >= ANY ( set of values )
attr >= ALL ( set of values )
EXISTS ( set of values )
....
|
- We will now learn
a
method to
form (= compute)
a
set of values:
|
Subquery:
prelude to nested query
- Syntax of a subquery:
- Meaning of a subquery:
- The result of
a subquery is:
- The
relation (= set) of
tuples
selected by the
SQL SELECT command in
the subquery
|
|
|
Subquery: how to use
- Where in
the SELECT command
can you put
a sub-query:
- A sub-query can be use
inside the
relation-list in the
FROM
clause:
SELECT attribute-list
FROM .... (subquery) ....
WHERE ....
|
- A sub-query can be use
inside the
WHERE
clause:
SELECT attribute-list
FROM ....
WHERE .... (subquery) ....
|
|
|
Subquery: usage
within the WHERE clause
❮
❯