SQL Sub-query
A subquery is a SQL query nested inside a larger query.
The subquery can be nested inside a SELECT, INSERT, UPDATE, or DELETE statement or inside another
subquery.
A subquery is usually added within the WHERE Clause of another SQL SELECT statement.
You can use the comparison operators, such as >, <, or =. The comparison operator can also be a multiple-
row operator, such as IN, ANY, or ALL.
A subquery is also called an inner query or inner select, while the statement containing a subquery is also
called an outer query or outer select.
The inner query executes first before its parent query so that the results of an inner query can be passed
to the outer query.
You can use a subquery in a SELECT, INSERT, DELETE, or UPDATE statement to perform
the following tasks:
Compare an expression to the result of the query.
Determine if an expression is included in the results of the query.
Check whether the query selects any rows.
END