Database Reference
In-Depth Information
| Pelecanidae | 10 | Pelecaniformes |
| Phalacrocoracidae | 61 | Suliformes |
| Scopidae | 3 | Pelecaniformes |
| Sulidae | 16 | Suliformes |
| Threskiornithidae | 53 | Pelecaniformes |
+-------------------+---------+----------------+
In these examples, it may seem to be a lot of typing to achieve very little. But there are
times — albeit rare times — when UNION is the best or simplest choice. It's more useful
when you retrieve data from very distinct, separate sources or other situations that would
require contortions to fit into a single SELECT statement and are executed more easily as
separate ones, still giving you a unified results set.
You can get the same results as the previous examples, though, with less effort by using a
subquery. Actually, when we put the UNION within parentheses, that became a subquery,
just not much of one. We'll cover subqueries later in this chapter. For now, let's consider
how to join multiple tables in one SQLstatement.
Search WWH ::




Custom Search