DB2
®
SQL Reference Volume 1
DB2 Version 9
for Linux, UNIX, and Windows
SC10-4249-00
DB2
®
SQL Reference Volume 1
DB2 Version 9
for Linux, UNIX, and Windows
SC10-4249-00
Before using this information and the product it supports, be sure to read the general information under Notices.
Edition Notice
This document contains proprietary information of IBM. It is provided under a license agreement and is protected
by copyright law. The information contained in this publication does not include any product warranties, and any
statements provided in this manual should not be interpreted as such.
You can order IBM publications online or through your local IBM representative.
v To order publications online, go to the IBM Publications Center at www.ibm.com/shop/publications/order
v To find your local IBM representative, go to the IBM Directory of Worldwide Contacts at www.ibm.com/
planetwide
To
order DB2 publications from DB2 Marketing and Sales in the United States or Canada, call 1-800-IBM-4YOU
(426-4968).
When you send information to IBM, you grant IBM a nonexclusive right to use or distribute the information in any
way it believes appropriate without incurring any obligation to you.
© Copyright International Business Machines Corporation 1993, 2006. All rights reserved.
US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract
with IBM Corp.
Contents
About this book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xv
Who should use this book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xv
How this book is structured . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xv
A brief overview of Volume 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvi
How to read the syntax diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvi
Conventions used in this manual . . . . . . . . . . . . . . . . . . . . . . . . . . . xviii
Error conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xviii
Highlighting conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xviii
Related documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix
Chapter 1. Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1
Relational databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1
Structured Query Language (SQL) . . . . . . . . . . . . . . . . . . . . . . . . . . . .1
Queries and table expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1
DB2 Call level interface (CLI) and open database connectivity (ODBC) . . . . . . . . . . . . . . . .2
Java database connectivity (JDBC) and embedded SQL for Java (SQLJ) programs . . . . . . . . . . . .2
Schemas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3
Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4
Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5
Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5
Unique constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6
Referential constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6
Table check constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9
Informational constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9
Indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10
Triggers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10
Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12
Aliases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12
Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13
Authorization, privileges, and object ownership . . . . . . . . . . . . . . . . . . . . . . .13
Catalog views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .18
Application processes, concurrency, and recovery . . . . . . . . . . . . . . . . . . . . . . .18
Isolation levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20
Comparison of isolation levels . . . . . . . . . . . . . . . . . . . . . . . . . . . .22
Table spaces and other storage structures . . . . . . . . . . . . . . . . . . . . . . . . .23
Character conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25
Distributed relational databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . .27
Remote unit of work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .28
Application-directed distributed unit of work . . . . . . . . . . . . . . . . . . . . . . .31
Data representation considerations . . . . . . . . . . . . . . . . . . . . . . . . . . .35
Event monitors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35
Database partitioning across multiple database partitions . . . . . . . . . . . . . . . . . . . .36
Large object behavior in partitioned tables . . . . . . . . . . . . . . . . . . . . . . . . .37
DB2 federated systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .39
Federated systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .39
What is a data source? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .40
The federated database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .40
The SQL compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .40
Wrappers and wrapper modules . . . . . . . . . . . . . . . . . . . . . . . . . . .41
Server definitions and server options . . . . . . . . . . . . . . . . . . . . . . . . . .42
User mappings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .42
Nicknames and data source objects . . . . . . . . . . . . . . . . . . . . . . . . . .43
Nickname column options . . . . . . . . . . . . . . . . . . . . . . . . . . . . .43
Data type mappings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .44
The federated server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .45
© Copyright IBM Corp. 1993, 2006 iii
评论0