Informix Guide to SQL: Tutorial
Chapter 3: Composing Advanced SELECT Statements
Home
Contents
Index
Master Index
New Book
Summary
This chapter builds on concepts introduced in
Chapter 2, "Composing Simple SELECT Statements."
It provides sample syntax and results for more advanced kinds of
SELECT
statements, which are used to perform a query on a relational database. This chapter presents the following material:
Introduces the
GROUP BY
and
HAVING
clauses, which can be used with aggregates to return groups of rows and apply conditions to those groups
Describes how to use the rowid to retrieve internal record numbers from tables and system-catalog tables and discusses the serial iternal table identifier or tabid
Shows how to join a table to itself with a self-join to compare values in a column with other values in the same column and to identify duplicates
Introduces the keyword
OUTER
, explains how an outer join treats two or more tables asymmetrically, and provides examples of the four kinds of outer join
Describes how to create correlated and uncorrelated subqueries by nesting a
SELECT
statement in the
WHERE
clause of another
SELECT
statement and shows the use of aggregate functions in subqueries
Demonstrates the use of the keywords
ALL
,
ANY
,
EXISTS
,
IN
, and
SOME
in creating subqueries, and the effect of adding the keyword
NOT
or a relational operator
Discusses the union, intersection, and difference set operations
Shows how to use the
UNION
and
UNION ALL
keywords to create compound queries that consist of two or more
SELECT
statements
Informix Guide to SQL: Tutorial
, version 9.1
Copyright © 1998, Informix Software, Inc. All rights reserved.