July 2010
Intermediate to advanced
976 pages
30h 19m
English
This section discusses two ways in which select queries may be used as components within a larger select query. First we examine how to specify the operations of union, intersection, and difference in SQL. Next we look at basic subqueries in SQL. Let’s begin with the union operation. The basic syntax is shown here. The reserved word “union” is allowed only between select queries, not between table names.
select-query
union [all]
select-query
...
The select queries must be union compatible (i.e., same number of columns, and corresponding columns are based on compatible data types). By default, a set is returned which is the union of the tables returned from the individual select queries, with any duplicate ...
Read now
Unlock full access