4.5 Examples

Example 1 shows an example of the use of the database definition utility.

Example 1
Define the following table and index:
  • Table: STOCK
  • Index: I1
The following RDAREAs have already been created:
  • PDBUSER01
  • PDBUSER02
  • PDBUSER03
  • PDBUSER04
Overview
[Figure]
Command execution
Explanation
  1. Definition of schema.
  2. Definition of table (STOCK).
  3. Definition of index (I1).
Explanation
Specification of input file /usr/crfile.
Contents of input file /usr/crfile

CREATE SCHEMA;                                                   1
CREATE TABLE STOCK(PCODE CHAR(4),PNAME NCHAR(8),                 2
                   COLOR NCHAR(1),PRICE INTEGER
                   SQUANTITY INTEGER)
              IN((PDBUSER01) PCODE<'302S',
                (PDBUSER02) PCODE>='302S');
CREATE INDEX I1 ON STOCK(PCODE) IN ((PDBUSER03),(PDBUSER04));    3

Explanation
  1. Definition of schema.
  2. Definition of table (STOCK).
  3. Definition of index (I1).