IBM i: Database SQL programming
IBM
IBM i
Database
SQL programming
7.1
IBM
IBM i
Database
SQL programming
7.1
Note
Before using this information and the product it supports, read the information in ¡°Notices,¡± on
page 493.
This edition applies to IBM i 7.1 (product number 5770-SS1) and to all subsequent releases and modifications until
otherwise indicated in new editions. This version does not run on all reduced instruction set computer (RISC)
models nor does it run on CISC models.
? Copyright IBM Corporation 1998, 2010.
US Government Users Restricted Rights ¨C Use, duplication or disclosure restricted by GSA ADP Schedule Contract
with IBM Corp.
Contents
SQL programming . . . . . . . . . . 1
|
|
|
|
What's new for IBM i 7.1 . . . . . . . . . . 1
PDF file for SQL programming . . . . . . . . 4
Introduction to DB2 for i Structured Query Language 4
SQL concepts . . . . . . . . . . . . . 5
SQL relational database and system
terminology . . . . . . . . . . . . 6
SQL and system naming conventions . . . . 7
Types of SQL statements . . . . . . . . 7
SQL communication area . . . . . . . . 9
SQL diagnostics area. . . . . . . . . . 9
SQL objects . . . . . . . . . . . . . . 9
Schemas . . . . . . . . . . . . . . 9
Journals and journal receivers . . . . . . 9
Catalogs . . . . . . . . . . . . . 10
Tables, rows, and columns . . . . . . . 10
Aliases . . . . . . . . . . . . . . 10
Views . . . . . . . . . . . . . . 10
Indexes . . . . . . . . . . . . . . 11
Constraints . . . . . . . . . . . . 11
Triggers . . . . . . . . . . . . . 12
Stored procedures . . . . . . . . . . 12
Sequences . . . . . . . . . . . . . 12
Global variables . . . . . . . . . . . 12
User-defined functions. . . . . . . . . 12
User-defined types . . . . . . . . . . 13
XSR objects . . . . . . . . . . . . 13
SQL packages . . . . . . . . . . . 13
Application program objects . . . . . . . . 13
User source file . . . . . . . . . . . 15
Output source file member . . . . . . . 15
Program . . . . . . . . . . . . . 15
SQL package . . . . . . . . . . . . 15
Module . . . . . . . . . . . . . . 16
Service program . . . . . . . . . . . 16
Data definition language . . . . . . . . . . 16
Creating a schema . . . . . . . . . . . 16
Creating a table . . . . . . . . . . . . 17
Adding and removing constraints . . . . . 17
Referential integrity and tables . . . . . . 18
Adding and removing referential
constraints. . . . . . . . . . . . 18
Example: Adding referential constraints . . 19
Example: Removing constraints. . . . . . 20
Check pending . . . . . . . . . . . 20
Creating a table using LIKE . . . . . . . . 21
Creating a table using AS. . . . . . . . . 21
Creating and altering a materialized query table 22
Declaring a global temporary table . . . . . 23
Creating a table with remote server data . . . 23
Creating a row change timestamp column . . . 24
Creating and altering an identity column . . . 24
Using ROWID . . . . . . . . . . . . 25
Creating and using sequences . . . . . . . 26
Comparison of identity columns and
sequences . . . . . . . . . . . . . 27
? Copyright IBM Corp. 1998, 2010
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Defining field procedures. . . . . . . .
Field definition for field procedures . . .
Specifying the field procedure . . . . .
When field procedures are invoked . . .
Parameter list for execution of field
procedures . . . . . . . . . . .
The field procedure parameter value list
(FPPVL) . . . . . . . . . . .
Parameter value descriptors for field
procedures . . . . . . . . . .
Field-definition (function code 8) . . .
Field-encoding (function code 0) . . .
Field-decoding (function code 4) . . .
Example field procedure program . . .
General guidelines for writing field
procedures . . . . . . . . . . .
Index considerations . . . . . . .
Thread considerations . . . . . . .
Debug considerations . . . . . . .
Guidelines for writing field procedures that
mask data . . . . . . . . . . . .
Example field procedure program that
masks data . . . . . . . . . .
Creating descriptive labels using the LABEL ON
statement . . . . . . . . . . . . .
Describing an SQL object using COMMENT ON
Changing a table definition . . . . . . .
Adding a column . . . . . . . . .
Changing a column. . . . . . . . .
Allowable conversions of data types . . .
Deleting a column . . . . . . . . .
Order of operations for the ALTER TABLE
statement . . . . . . . . . . . .
Using CREATE OR REPLACE TABLE . .
Creating and using ALIAS names . . . . .
Creating and using views. . . . . . . .
WITH CHECK OPTION on a view . . .
WITH CASCADED CHECK OPTION .
WITH LOCAL CHECK OPTION . . .
Example: Cascaded check option . . .
Creating indexes. . . . . . . . . . .
Creating and using global variables . . . .
Replacing existing objects. . . . . . . .
Catalogs in database design . . . . . . .
Getting catalog information about a table .
Getting catalog information about a column
Dropping a database object . . . . . . .
Data manipulation language. . . . . . . .
Retrieving data using the SELECT statement .
Basic SELECT statement . . . . . . .
Specifying a search condition using the
WHERE clause . . . . . . . . . .
Expressions in the WHERE clause . . .
Comparison operators . . . . . . .
NOT keyword . . . . . . . . .
GROUP BY clause . . . . . . . . .
.
.
.
.
28
29
29
29
. 30
. 32
.
.
.
.
.
32
33
34
35
36
.
.
.
.
37
38
38
38
. 38
. 41
. 42
43
. 44
. 44
. 44
. 45
. 46
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
46
47
48
48
50
51
51
52
53
53
54
54
55
55
55
56
56
56
.
.
.
.
.
57
58
59
60
60
iii
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- sql if exists in rpgiv
- structured query language
- sap hana sqlscript reference for sap hana platform sap online help
- data sheet oracle real application testing
- sql queries programming triggers university of wisconsin madison
- repairing the nagios xi databases
- ibm i database sql programming
- securing pl sql applications with dbms assert ncc group research blog
- high availability solutions
- how to write sql injection proof pl sql oracle
Related searches
- azure sql database hyperscale
- azure sql database version
- azure sql database paas
- azure sql database timezone
- azure sql database versions
- azure sql database ms managed instance
- sql programming with python
- python database programming examples
- sql database backup tool
- oracle database 11g sql pdf
- create database sql server script
- ibm db2 sql reference guide