You are on page 1of 1

Chapter 3

Selecting
3.1 Introduction
This chapter talks about three different ways to select data from the database:
the SQL select and the UNLOAD and ISQL OUTPUT statements. Of the 40
sections and subsections in this chapter, 36 are devoted to the SQL select, a tes-
tament to its importance. Even section 3.23, CREATE VIEW, is really about
the SQL select.
Simply put, a SQL select is a mechanism that returns a result set, where a
result set is zero or more rows consisting of one or more columns of data. In this
book, the lowercase word select refers to this general mechanism for return-
ing a result set, and the uppercase SELECT refers to the keyword that appears
at least once in each select.
Section 3.2 presents a list of imaginary or logical steps that could be used to
execute a SQL select. This list is presented to help explain what each clause can
do for you. This is important, because the order in which the clauses are coded
gives few clues about what they do and how they interact, and more impor-
tantly, how they interfere with one another. If youve ever had trouble with the
GROUP BY clause, or had a SELECT that returned 10,000 rows instead of the
three you wanted, or wondered why you cant call NUMBER(*) in a WHERE
clause, this chapter has the answers. With examples.
Sections 3.3 through 3.24.1 explain the syntax and semantics of the various
clauses and components, in roughly the same order as the logical steps pre-
sented in Section 3.2. Thats the reason the FROM clause comes first, for
example, long before the SELECT list.
This is also the chapter that discusses the syntax of expressions, including
boolean expressions. Expressions may appear in many other SQL statements,
but its in the SELECT where they get their heaviest workout, and thats why
theyre explained here.
Sections 3.25 and 3.26, about UNLOAD and ISQL OUTPUT, close this
chapter with discussions of two methods where result sets can be written
directly to files.

69

You might also like