Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

COLLATING_SEQUENCE

DATABASE

DOMAIN

INDEX

SCHEMA

STORAGE_AREA

STORAGE_MAP

TABLE

TRIGGER

VIEW

More Information

More Information

data type

FROM clause

default value

sql and dtr clause

authorization id

USER

NULL

CURRENT_TIMESTAMP

More information

literal

More Information

ASC

DESC

MAPPING_VALUES

More Information

SIZE IS n

index store clause

More Information

More Information

authorization id

root file params1

root file params2

storage area params

schema element

More Information

More Information

extension options

More Information

More Information

More Information

storage area params

More Information

store clause

STORE LISTS IN area-name

FOR table-name

More Information

column-name

More Information

col definition

FROM clause

table constraint

COLLATING_SEQUENCE_IS

COMPUTED_BY

CHECK

NOT_NULL

More Information

data type

default value

value expr

col constraint

sql and dtr clause

USER

NULL

CURRENT_TIMESTAMP

More information

literal

More Information

char value expr

char value expr

More Information

references clause

authorization id

More Information

references clause

More Information

trigger name

column name

table name

referencing clause

triggered action

More Information

old alias

new alias

triggered statement

More Information

ERROR

delete statement

update statement

insert statement

More Information

select expr

sql and dtr clause

order by clause

limit to clause

check option clause

More Information

UNION

select clause

More Information

ALL

RDB/VMS SQL CREATE — VMS RDB_4.0B

 Creates definitions for VAX SQL.

Additional information available:

COLLATING_SEQUENCEDATABASEDOMAININDEXSCHEMA
STORAGE_AREASTORAGE_MAPTABLETRIGGERVIEW

COLLATING_SEQUENCE

 CREATE COLLATING SEQUENCE sequence-name ──┐
   ┌───────────────────────────────────────┘
   └──┬────────────────────────────┬──┐
      └─> 
C

O

M

M

E

N

T

I

S
──> typebox (")string" ─┘ │ ┌───────────────────────────┘ └─>ncs-name ─┬───────────────────────┬──> typebox (;) └─> 
F

R

O

M
library-name ──┘

Additional information available:

More Information

More Information

 Identifies a collating sequence other than the database default
 collating sequence that you plan to use with certain domains.  (You
 must use a collating sequence that has been defined using the VMS
 National Character Set (NCS) utility.)

 The default collating sequence for a database is established by the
 COLLATING SEQUENCE IS clause in the CREATE SCHEMA statement; if you
 omit that clause at database definition time, the default sequence is
 ASCII.

 You must enter a CREATE COLLATING SEQUENCE statement before you enter
 the name of that sequence in CREATE DOMAIN or ALTER DOMAIN
 statements.

DATABASE

 The CREATE DATABASE statement is supported only for upward
 compatibility.  For information on creating databases see the Help
 topic on CREATE SCHEMA.

DOMAIN

 CREATE DOMAIN ─┐
 ┌──────────────┘
 ├─> domain-name IS data-type ─┬───────────────────┬──┐
 │                             └──>default-value ──┘  │
 │   ┌────────────────────────────────────────────────┘
 │   └─┬────────────────────────────────────────────────────┬─┐
 │     ├─> 
C

O

L

L

A

T

I

N

G

S

E

Q

U

E

N

C

E
typebox (I)typebox (S) sequence-name ────────────┤ │ │ └─> 
N

O

C

O

L

L

A

T

I

N

G

S

E

Q

U

E

N

C

E
───────────────────────────┘ │ │ ┌────────────────────────────────────────────────┘ │ └──┬──────────────────────────┬──────────────────────┬────> typebox (;) │ └─┬─>sql-and-dtr-clause ─┬─┘ │ │ └───────────<──────────┘ │ └─> 
F

R

O

M
──> path-name ───┬─────────────────>───────────────┬───┘ └─> 
S

C

H

E

M

A
typebox (A)typebox (U)typebox (T)typebox (H)typebox (O)typebox (R)typebox (I)typebox (Z)typebox (A)typebox (T)typebox (I)typebox (O)typebox (N) auth-id ─┘

Additional information available:

More Informationdata typeFROM clausedefault valuesql and dtr clause

More Information

 Creates a domain definition, which includes the domain name, a data
 type, and optional SQL and DATATRIEVE support clauses.  The domain
 name must be unique among domain names in the database.

 When the CREATE DOMAIN statement executes, VAX SQL adds the domain
 definition to the physical database.  If you declared the schema with
 the PATHNAME specification, the domain definition is also added to
 the data dictionary.

 Domains ensure that similar columns in multiple tables will comply to
 one standard.  Once you have a defined domain, use the CREATE or
 ALTER TABLE statement to define many columns based on a domain
 definition.  Domains also allow you to change the data type or SQL
 and DATATRIEVE parameters for all columns defined using a domain,
 simply by changing the domain itself.

data type

 data-type =

 ──┬─> 
C

H

A

R
─┬────────┬───────────────────────────┬──> │ └─> (n) ─┘ │ ├─> 
V

A

R

C

H

A

R
(n) ───────────────────────────────┤ ├─> 
L

O

N

G

V

A

R

C

H

A

R
──────────────────────────────┤ ├─> 
T

I

N

Y

I

N

T
──────────────┬─────┬────────┬─────┤ ├─> 
S

M

A

L

L

I

N

T
─────────────┤ └─> (n) ─┘ │ ├─> 
I

N

T

E

G

E

R
──────────────┤ │ ├─> 
Q

U

A

D

W

O

R

D
─────────────┤ │ ├─> 
L

I

S

T

O

F

B

Y

T

E

V

A

R

Y

I

N

G
─┘ │ ├─> 
D

E

C

I

M

A

L
─┬─┬─────────────────────────────┬─┤ ├─> 
N

U

M

E

R

I

C
─┘ └─> ( ──> n ─┬────────┬─> ) ──┘ │ │ └─> , n ─┘ │ ├─> 
F

L

O

A

T
─┬────────┬──────────────────────────┤ │ └─> (n) ─┘ │ ├─> 
R

E

A

L
──────────────────────────────────────┤ ├─> 
D

O

U

B

L

E

P

R

E

C

I

S

I

O

N
──────────────────────────┤ └─> 
D

A

T

E
──────────────────────────────────────┘

FROM clause

 The FROM clause specifies the data dictionary path name of a
 dictionary field definition.  SQL creates the domain using the
 definition from this record.

 You can specify either a full data dictionary path name or a relative
 data dictionary path name.

 You cannot specify SQL and DATATRIEVE support clauses if you use the
 FROM path-name form of the CREATE DOMAIN statement.

Additional information available:

authorization id

authorization id

 The authorization identifier specifies the name for an attachment to
 a particular database.  SQL adds the domain definition to the
 database referred to by the authorization identifier.

 If you do not specify an authorization identifier, SQL adds the
 domain definition to the default schema.

default value

 default-value =

 DEFAULT ──┬──>literal ─┬───>
           ├──>
U

S

E

R
───┤ └──>
N

U

L

L
───┘

Additional information available:

USERNULLCURRENT_TIMESTAMP

More informationliteralMore Information

More information

 The default value of a column is the value stored in the database if
 an insert operation on a row specifies no value for that column.  You
 can use literals, the NULL keyword, the current timestamp, or the
 user name as default values.  If you do not specify a default value,
 SQL assigns NULL as the default value.

 If you specify a default value for a column in a table, it overrides
 any default value specified for the domain on which the column is
 based.

 You might have any of several possible reasons for specifying a
 default value for a column; for instance, you may want to store the
 most commonly used value, or you may want to store a value that
 highlights (is visual displays) the fact that no value was stored.

literal

 A value expression that is either numeric, character string, or date.

USER

 The user name of the process that invokes interactive SQL or runs a
 program.

NULL

 A null value.

CURRENT_TIMESTAMP

 The date and time currently defined in Rdb/VMS.

More Information

 A value to be stored in a column if the row that is inserted does not
 include a value for that column.  You can use literals, the NULL
 keyword, the current timestamp, or the user name as default values.
 If you do not specify a default value, SQL assigns NULL as the
 default value.

sql and dtr clause

 sql-and-dtr-clause =

 ─┬─> 
Q

U

E

R

Y

H

E

A

D

E

R
typebox (I)typebox (S) ─┬> quoted-string ──┬─────────────────┬─> │ └────── typebox (/) <────────┘ │ ├─> 
E

D

I

T

S

T

R

I

N

G
typebox (I)typebox (S) quoted-string ─────────────────────────┤ │ │ ├─> 
Q

U

E

R

Y

N

A

M

E
Ftypebox (O)typebox (R) ─┬─> typebox (D)typebox (T)typebox (R) ────────┬─> typebox (I)typebox (S) quoted-string ─┤ │ └─> typebox (D)typebox (A)typebox (T)typebox (A)typebox (T)typebox (R)typebox (I)typebox (E)typebox (V)typebox (E) ─┘ │ ├─> 
D

E

F

A

U

L

T

V

A

L

U

E
Ftypebox (O)typebox (R) ─┬─> typebox (D)typebox (T)typebox (R) ────────┬─> typebox (I)typebox (S) literal ────┤ │ └─> typebox (D)typebox (A)typebox (T)typebox (A)typebox (T)typebox (R)typebox (I)typebox (E)typebox (V)typebox (E) ─┘ │ ├─> 
N

O

Q

U

E

R

Y

H

E

A

D

E

R
──────────────────────────────────────┤ ├─> 
N

O

E

D

I

T

S

T

R

I

N

G
───────────────────────────────────────┤ ├─> 
N

O

Q

U

E

R

Y

N

A

M

E
────┬──> Ftypebox (O)typebox (R) ─┬─> typebox (D)typebox (T)typebox (R) ────────┬─────────┘ └─> 
N

O

D

E

F

A

U

L

T

V

A

L

U

E
─┘ └─> typebox (D)typebox (A)typebox (T)typebox (A)typebox (T)typebox (R)typebox (I)typebox (E)typebox (V)typebox (E) ─┘ Optional formatting clauses allow you to modify data displays or query characteristics for interactive SQL users and DATATRIEVE users. A query header specifies a string that interactive SQL or DATATRIEVE displays in place of the column name when it retrieves values from a column. An edit string specifies a string that controls how interactive SQL or DATATRIEVE formats the display of values in a column. DEFAULT VALUE and QUERY NAME are active only from DATATRIEVE.

INDEX

 CREATE ─┬───────────┬─> 
I

N

D

E

X
index-name ───> 
O

N
table-name ──┐ └─> 
U

N

I

Q

U

E
─┘ │ ┌───────────────────────────────<─────────────────────────────┘ └> ( ─┬> column-name ┬───────┬─┬────────────────────────┬┬─> ) ┐ │ ├> typebox (A)typebox (S)typebox (C) ─┤ ├> typebox (S)typebox (I)typebox (Z)typebox (E) typebox (I)typebox (S) n ────────────┤│ │ │ └> typebox (D)typebox (E)typebox (S)typebox (C) ┘ └> typebox (M)typebox (A)typebox (P)typebox (P)typebox (I)typebox (N)typebox (G) typebox (V)typebox (A)typebox (L)typebox (U)typebox (E)typebox (S) l TO h ┘│ │ └───────────────────────────── , <─────────────────┘ │ ┌────────────────────────<─────────────────────────────────────┘ └─┬────────────────────────────>────────────────────────────────┬─┐ └─> 
T

Y

P

E
typebox (I)typebox (S) ─┬─> 
S

O

R

T

E

D
─┬────────────────────────────────┬─┬─┘ │ │ └┬┬─> 
N

O

D

E

S

I

Z

E
number-bytes ──┬┬┘ │ │ │ │├─> 
P

E

R

C

E

N

T

F

I

L

L
percentage ─┤│ │ │ │ │└─> 
U

S

A

G

E
─┬─> 
U

P

D

A

T

E
─┬─────┘│ │ │ │ │ └─> 
Q

U

E

R

Y
──┘ │ │ │ │ └────────────────<─────────────┘ │ │ └─> 
H

A

S

H

E

D
────────────────────────────────────┘ │ ┌─────────────────────────────────────────────────────────────────┘ └─┬───────────────────────┬─> typebox (;) └─> index-store-clause ─┘

Additional information available:

ASCDESCMAPPING_VALUES

More InformationSIZE IS nindex store clause

More Information

 The CREATE INDEX statement defines an index for a base table.  An
 index allows direct access to the rows in the table to avoid
 sequential searching.

 You define an index by listing the columns in a table that make up
 the index.  You can define more than one index for a table.  The
 index can be either simple or multisegmented.  A simple index is made
 up of one column while a multisegmented index is made up of two or
 more columns.

 Optional arguments to CREATE INDEX let you specify:

  o  The characteristics of index nodes

  o  Whether the index is a hashed index or a B-tree index

  o  The names of a storage area or storage areas that will contain
     the index

  o  Whether the index segments are created in ascending or descending
     order

ASC

 This optional keyword causes SQL to create ascending index segments.
 An ascending index is one in which index keys are stored in ascending
 sequence.

 If you omit the ASC or DESC keywords, ascending order is the default.

DESC

 This optional keyword causes SQL to create descending index segments.
 A descending index is one in which index keys are stored in
 descending sequence.  A descending index can improve the performance
 of queries that retrieve records with high index key values.

 If you omit the ASC or DESC keywords, ascending order is the default.

SIZE IS n

 A compression clause for text or varying text index keys that limits
 the number of characters used for retrieving data.

 The n specifies the number of characters of the key that are used in
 the index.

 The compressed key must be specified with a DUPLICATES ARE ALLOWED
 clause.

MAPPING_VALUES

 A compression clause for all-numeric columns that translates the
 column values into a more compactly encoded form.

 You can mix mapped and unmapped columns, but the most storage space
 is gained by building indexes of multiple columns of data type WORD
 or LONGWORD.

 The l (low) through h (high) specifies the range of integers as the
 value of the index key.  <P> For the compressed key:
     ,le The valid range cannot be zero

  o  The range h through l is limited to (2**31) through 4 x
     (10**scale)

index store clause

 index-store-clause = STORE ─┐
 ┌───────────────────────────┘
 ├─> 
I

N
area-name ─────────────────────────────────────────────────┬─> └─> 
U

S

I

N

G
─> ( ─┬─> column-name ─┬─> ) ─┐ │ └────── , <──────┘ │ │ ┌──────────────────────────────────────┘ │ └┬─> 
I

N
area-name WITH LIMIT OF ─> ( ─┬─ literal ─┬─> ) ─┬─┐ │ │ └──── , <───┘ │ │ │ └────────────────────────── <───────────────────────────┘ │ │ ┌──────────────────────────────────────────────────────────┘ │ └─> 
O

T

H

E

R

W

I

S

E
typebox (I)typebox (N) area-name ──────────────────────────────────────┘

Additional information available:

More Information

More Information

 A storage map definition for the index.  You can specify a store
 clause for indexes in a multifile schema only.  The STORE clause in a
 CREATE INDEX statement allows you to specify which storage area files
 will be used to store the index entries:

  o  All index entries can be associated with a single storage area.

  o  Index entries can be systematically distributed, or partitioned,
     among several storage areas by specifying upper limits on the
     values for a key in a particular storage area.

 If you omit the storage map definition, the default is to store all
 the entries for an index in the main RDB$SYSTEM storage area.

 You should define a storage area for an index that matches the
 storage map for the table with which it is associated.

SCHEMA

 CREATE SCHEMA ─┬──────────────────────────┬────────────┐
                └─> 
A

U

T

H

O

R

I

Z

A

T

I

O

N
auth-id ─┘ │ ┌──────────────────────────────────────────────────────┘ └┬──────────────────────────┬┬──────────────────────────┬─┐ └┬─> root-file-params-1 ─┬┘└─┬─> root-file-params-2 ┬─┘ │ └───────────────<────────┘ └──────────<───────────┘ │ ┌─────────────────────────────────────────────────────────┘ └┬──────────────────────────┬┬──────────────────────┬─> typebox (;) └──> storage-area-params ──┘└─┬─> schema-element ┬┘ └─────────<─────────┘

Additional information available:

More Informationauthorization idroot file params1root file params2
storage area paramsschema element

More Information

 The CREATE SCHEMA statement creates a schema.  A schema is the
 definitions that comprise a database.  CREATE SCHEMA lets you specify
 in a single SQL statement all data and privilege definitions for a
 new schema (you can also add definitions to the schema later).

 In its simplest form, CREATE SCHEMA at least creates database system
 files, specifies their names, and determines the physical
 characteristics of the database.  Using the optional elements of
 CREATE SCHEMA, you can also specify:

  o  Whether the database created with CREATE SCHEMA is multifile or
     single-file.  The presence or absence of a CREATE STORAGE AREA
     statement in a CREATE SCHEMA statement is what determines whether
     the schema is single-file or multifile.

  o  Values for various root file parameters.

  o  Values for storage area parameters.

  o  Any number of schema elements (CREATE statements or a GRANT
     statement).

authorization id

 AUTHORIZATION auth-id specifies the authorization identifier for the
 implicit schema declaration executed by CREATE SCHEMA.  An
 authorization identifier is a name for a particular attachment to a
 schema.  For more information see the Help topic on authorization-id.

root file params1

 root-file-params-1 =
 ──────┬──────────────────────────> ───────────────────────────────┬────>
       ├─> 
F

I

L

E

N

A

M

E
file-spec ─────────────────────────────────────┤ ├─> 
P

A

T

H

N

A

M

E
path-name ─────────────────────────────────────┤ ├─> 
D

B

K

E

Y

S

C

O

P

E
typebox (I)typebox (S) ─┬─> 
T

R

A

N

S

A

C

T

I

O

N
─┬──────────────────────┤ │ └─> 
A

T

T

A

C

H
──────┘ │ ├─> 
C

O

L

L

A

T

I

N

G

S

E

Q

U

E

N

C

E
sequence-name ──┬───────────────┬─┐ │ │ └─> 
C

O

M

M

E

N

T

I

S
─┘ │ │ │ ┌─────────────────────────────────────────────────────┘ │ │ └┬─────────────┬──> ncs-name ─┬───────────────────────┬──┤ │ └─> typebox (")string" ─┘ └─> 
F

R

O

M
library-name ──┘ │ ├─> 
N

U

M

B

E

R
typebox (O)F 
U

S

E

R

S
typebox (I)typebox (S) ──> number-users ────────────────────┤ ├─> 
N

U

M

B

E

R
typebox (O)F 
B

U

F

F

E

R

S
typebox (I)typebox (S) ─────> number-buffers ─────────────┤ ├─> 
N

U

M

B

E

R
typebox (O)F 
V

A

X

C

L

U

S

T

E

R

N

O

D

E

S
typebox (I)typebox (S) ──> number-nodes ─────────┤ ├─> 
N

U

M

B

E

R
typebox (O)F 
R

E

C

O

V

E

R

Y

B

U

F

F

E

R

S
typebox (I)typebox (S) ───> number-buffers ──────┤ └─> 
B

U

F

F

E

R

S

I

Z

E
typebox (I)typebox (S) ─────> buffer-blocks ──> 
B

L

O

C

K

S

─────────┘

root file params2

 root-file-params-2 =
 ──────┬──────────────────────────> ───────────────────────────────┬────>
       ├─> 
S

N

A

P

S

H

O

T
typebox (I)typebox (S) ────┬─────> 
E

N

A

B

L

E

D
─┬─> 
I

M

M

E

D

I

A

T

E
──┬─┬──┤ │ │ └─> 
D

E

F

E

R

R

E

D
────┘ │ │ │ └─────> 
D

I

S

A

B

L

E

D
───────────>────────┘ │ ├─> 
D

I

C

T

I

O

N

A

R

Y
typebox (I)typebox (S) ───┬───> 
R

E

Q

U

I

R

E

D
───────┬────────────────┤ │ └───> 
N

O

T

R

E

Q

U

I

R

E

D
───┘ │ ├─> 
A

D

J

U

S

T

A

B

L

E

L

O

C

K

G

R

A

N

U

L

A

R

I

T

Y
typebox (I)typebox (S) ─┬─> 
E

N

A

B

L

E

D
──┬─────────┤ │ └─> 
D

I

S

A

B

L

E

D
─┘ │ ├─> 
S

E

G

M

E

N

T

E

D

S

T

R

I

N

G
typebox (S)typebox (T)typebox (O)typebox (R)typebox (A)typebox (G)typebox (E) 
A

R

E

A
typebox (I)typebox (S) area-name ─────────────┤ └─> 
P

R

O

T

E

C

T

I

O

N
typebox (I)typebox (S) ───┬───> 
A

N

S

I
──┬─────────────────────────┘ └───> 
A

C

L
───┘

Additional information available:

More Information

More Information

 Root file parameters are parameters that control the characteristics
 of the database root file associated with the schema, or
 characteristics stored in the root file that apply to the entire
 database.  You can specify these parameters for either single-file or
 multifile databases.

 Not all root file parameters specified in CREATE SCHEMA can be
 changed with the ALTER SCHEMA statement.  To change the root file
 parameters that cannot be changed with the ALTER SCHEMA statement,
 you must use the EXPORT and IMPORT statements in the RDO utility of
 Rdb/VMS.

storage area params

 storage-area-params =

 ─┬─┬──────────────────────────>─────────────────────────────┬─┬──>
  │ ├─> 
A

L

L

O

C

A

T

I

O

N
typebox (I)typebox (S) ───> number-pages ────> typebox (P)typebox (A)typebox (G)typebox (E)typebox (S) ─────────┤ │ │ ├─> 
P

A

G

E

S

I

Z

E
typebox (I)typebox (S) ────> page-blocks ─────> typebox (B)typebox (L)typebox (O)typebox (C)typebox (K)typebox (S) ────────┤ │ │ ├─> 
P

A

G

E

F

O

R

M

A

T
typebox (I)typebox (S) ──┬────> 
U

N

I

F

O

R

M
────┬────────────────┤ │ │ │ └────> 
M

I

X

E

D
──────┘ │ │ │ ├─> 
T

H

R

E

S

H

O

L

D

S
typebox (A)typebox (R)typebox (E) ( val1 ─┬──────────────────────┬─> ) ─┤ │ │ │ └─> ,val2 ─┬──────────┬┘ │ │ │ │ └─> ,val3 ─┘ │ │ │ ├─> 
I

N

T

E

R

V

A

L
typebox (I)typebox (S) ───────> number-data-pages ──────────────┤ │ │ ├─> 
E

X

T

E

N

T
typebox (I)typebox (S) ────┬──> extent-pages ────> typebox (P)typebox (A)typebox (G)typebox (E)typebox (S) ────┬────┤ │ │ │ └──> (extension-options)──────────┘ │ │ │ ├─> 
S

N

A

P

S

H

O

T

F

I

L

E

N

A

M

E
───> file-spec ────────────────────┤ │ │ ├─> 
S

N

A

P

S

H

O

T

A

L

L

O

C

A

T

I

O

N
typebox (I)typebox (S) ──> snp-pages ──> typebox (P)typebox (A)typebox (G)typebox (E)typebox (S) ──────┤ │ │ └─> 
S

N

A

P

S

H

O

T

E

X

T

E

N

T
typebox (I)typebox (S) ─┬─> extent-pages ──> typebox (P)typebox (A)typebox (G)typebox (E)typebox (S) ─┬────┘ │ │ └─> (extension-options) ────┘ │ └────────────────────────────<───────────────────────────────┘

Additional information available:

More Informationextension options

More Information

 Storage area parameters are parameters that control the
 characteristics of database storage area files.  You can specify most
 storage area parameters for either single-file or multifile
 databases, but the effect of the clauses differs:

  o  For single-file databases, the storage area parameters specify
     the characteristics for the single storage area in the schema

  o  For multifile databases, the storage area parameters specify a
     set of default values for any storage areas created by the CREATE
     SCHEMA statement that do not specify their own values for the
     same parameters.  The default values apply to the RDB$SYSTEM
     storage area, plus any others named in CREATE STORAGE AREA schema
     elements.

     CREATE STORAGE AREA clauses within the CREATE SCHEMA statement
     can override these default values.

extension options

 extension-options =

 ──> 
M

I

N

I

M

U

M
typebox (O)F min-pages PAGES, ─┐ ┌────────────────────────────────┘ └─> 
M

A

X

I

M

U

M
typebox (O)F max-pages PAGES, ┐ ┌───────────────────────────────┘ └─> 
P

E

R

C

E

N

T

G

R

O

W

T

H
typebox (I)typebox (S) growth ──>

Additional information available:

More Information

More Information
 Extension options are useful for exercising greater control over the
 size and growth of an extent or snapshot extent when the 100 page
 default is not desired.  Extension options are particularly useful
 with multivolume databases.  Extension options include the MIN, MAX,
 and PERCENT parameters.

 If you use the MIN, MAX, and PERCENT parameters, you must enclose
 them in parentheses:  (MINIMUM OF min-pages PAGES, MAXIMUM OF
 max-pages PAGES, PERCENT GROWTH IS growth).

 MINIMUM OF min-pages PAGES specifies the minimum number of pages of
 each extent.  The default is 100 pages.

 MAXIMUM OF max-pages PAGES specifies the maximum number of pages of
 each extent.  The default is 10,000 pages.

 PERCENT GROWTH IS growth specifies the percent growth of each extent.
 The default is 20 percent growth.

schema element

 schema-element =
 ─┬─> create-storage-area-clause ──────────┬─>
  ├─> create-storage-map-statement ────────┤
  ├─> create-collating-sequence-statement ─┤
  ├─> create-domain-statement ─────────────┤
  ├─> create-table-statement ──────────────┤
  ├─> create-trigger-statement ────────────┤
  ├─> create-index-statement ──────────────┤
  ├─> create-view-statement ───────────────┤
  └─> grant-statement ─────────────────────┘

Additional information available:

More Information

More Information

 A schema element is a CREATE STORAGE AREA clause, any CREATE
 statement or a GRANT statement:

  o  CREATE STORAGE AREA clause

  o  CREATE STORAGE MAP statement

  o  CREATE DOMAIN statement

  o  CREATE TABLE statement

  o  CREATE INDEX statement

  o  CREATE VIEW statement

  o  GRANT statement

STORAGE_AREA

 CREATE STORAGE AREA ──┬─> area-name ──┬┬───────────────────────┬─┐
                       └─> 
R

D

B

$

S

Y

S

T

E

M
─┘└─> 
F

I

L

E

N

A

M

E
file-spec ─┘ │ ┌────────────────────────────────────────────────────────────────┘ └┬────────────────────────┬─> typebox (;) └─> storage-area-params ─┘

Additional information available:

More Informationstorage area params

More Information

 You cannot issue CREATE STORAGE AREA as an independent statement.  It
 is a clause allowed as part of a CREATE SCHEMA or IMPORT statement.

 The CREATE STORAGE AREA clause creates additional storage areas in a
 multifile schema.  A storage area is data and snapshot files that are
 associated with particular tables in a multifile schema.

 A CREATE STORAGE AREA clause specifies the names for the storage area
 files and determines their physical characteristics.  Subsequent
 CREATE STORAGE MAP statements actually associate the storage area
 with particular tables or columns of tables in the schema.

storage area params

 storage-area-params =

 ─┬─┬──────────────────────────>─────────────────────────────┬─┬──>
  │ ├─> 
A

L

L

O

C

A

T

I

O

N
typebox (I)typebox (S) ───> number-pages ────> typebox (P)typebox (A)typebox (G)typebox (E)typebox (S) ─────────┤ │ │ ├─> 
P

A

G

E

S

I

Z

E
typebox (I)typebox (S) ────> page-blocks ─────> typebox (B)typebox (L)typebox (O)typebox (C)typebox (K)typebox (S) ────────┤ │ │ ├─> 
P

A

G

E

F

O

R

M

A

T
typebox (I)typebox (S) ──┬────> 
U

N

I

F

O

R

M
────┬────────────────┤ │ │ │ └────> 
M

I

X

E

D
──────┘ │ │ │ ├─> 
T

H

R

E

S

H

O

L

D

S
typebox (A)typebox (R)typebox (E) ( val1 ─┬──────────────────────┬─> ) ─┤ │ │ │ └─> ,val2 ─┬──────────┬┘ │ │ │ │ └─> ,val3 ─┘ │ │ │ ├─> 
I

N

T

E

R

V

A

L
typebox (I)typebox (S) ───────> number-data-pages ──────────────┤ │ │ ├─> 
E

X

T

E

N

T
typebox (I)typebox (S) ────┬──> extent-pages ────> typebox (P)typebox (A)typebox (G)typebox (E)typebox (S) ────┬────┤ │ │ │ └──> (extension-options)──────────┘ │ │ │ ├─> 
S

N

A

P

S

H

O

T

F

I

L

E

N

A

M

E
───> file-spec ────────────────────┤ │ │ ├─> 
S

N

A

P

S

H

O

T

A

L

L

O

C

A

T

I

O

N
typebox (I)typebox (S) ──> snp-pages ──> typebox (P)typebox (A)typebox (G)typebox (E)typebox (S) ──────┤ │ │ └─> 
S

N

A

P

S

H

O

T

E

X

T

E

N

T
typebox (I)typebox (S) ─┬─> extent-pages ──> typebox (P)typebox (A)typebox (G)typebox (E)typebox (S) ─┬────┘ │ │ └─> (extension-options) ────┘ │ └────────────────────────────<───────────────────────────────┘ Storage area parameters control the characteristics of database storage area files.

STORAGE_MAP

 CREATE STORAGE MAP map-name ───────────┐
 ┌──────────────────────────────────────┘
 ├─> 
F

O

R
table-name ─────┬─┬─> store-clause ───────────────────┬─┬─┬─> typebox (;) │ │ ├─> 
P

L

A

C

E

M

E

N

T

V

I

A

I

N

D

E

X
index-name ─┤ │ │ │ │ └─┬─> 
E

N

A

B

L

E
──┬─> 
C

O

M

P

R

E

S

S

I

O

N
─────┘ │ │ │ │ └─> 
D

I

S

A

B

L

E
─┘ │ │ │ └─────────────────── <──────────────────┘ │ │ │ └─> 
S

T

O

R

E

L

I

S

T

S
─┬> 
I

N
area-name ──┬────────────>──────────────┬─┬┘ │ ┌───────────┘ │ │ │ │ │ │ │ └─> 
F

O

R
─>( ┬>table-name ─────────┬─> ) ┘ │ │ ├>table-name.col-name │ │ │ └───────── , <────────┘ │ └─────────────────────<─────────────────────────┘

Additional information available:

More Informationstore clauseSTORE LISTS IN area-nameFOR table-name

More Information

 Associates a table with one or more storage areas.  CREATE STORAGE
 MAP specifies a storage map that controls which rows of a table or
 which lists are stored in which storage areas.  You can specify
 separate storage areas for the lists in one or more tables or for the
 lists in certain columns of tables.

 In addition to creating storage maps, CREATE STORAGE MAP has options
 that control:

  o  Which index the database system uses when inserting rows in the
     table

  o  Whether the rows of the table will be stored in a compressed
     format

store clause

 store-clause = STORE ─┐
 ┌─────────────────────┘
 ├─> 
I

N
area-name ─────────────────────────────────────────────────┬─> ├─> 
A

C

R

O

S

S
─> ( ─┬─> area-name ─┬─> ) ────────────────────────────┤ │ └───── , <─────┘ │ └─> 
U

S

I

N

G
─> ( ─┬─> column-name ─┬─> ) ─┐ │ └────── , <──────┘ │ │ ┌──────────────────────────────────────┘ │ └┬─> 
I

N
area-name WITH LIMIT OF ─> ( ─┬─ literal ─┬─> ) ─┬─┐ │ │ └──── , <───┘ │ │ │ └────────────────────────── <───────────────────────────┘ │ │ ┌──────────────────────────────────────────────────────────┘ │ └─> 
O

T

H

E

R

W

I

S

E
typebox (I)typebox (N) area-name ──────────────────────────────────────┘

Additional information available:

More Information

More Information

 The STORE clause specifies the storage map definition.  The STORE
 clause in a CREATE STORAGE MAP statement allows you to specify which
 storage area files will be used to store rows from the table:

  o  All rows of a table can be associated with a single storage area

  o  Rows of a table can be randomly distributed among several storage
     areas

  o  Rows of a table can be systematically distributed, or
     partitioned, among several storage areas by specifying upper
     limits on the values for a column in a particular storage area


 If you omit the storage map definition, the default is to store all
 the records for a table in the main RDB$SYSTEM storage area.

STORE LISTS IN area-name

 Directs the database system to store the lists from one or more
 tables or columns of tables in a specified storage area.

FOR table-name

 ,br Specifies the table or tables to which this storage map will
 apply.  The named table must already be defined and cannot have a
 storage map associated with it.  For each area, you can specify one
 FOR clause and list of table-names.

Additional information available:

column-name

column-name

 ,br Specifies the column of a particular table which this storage map
 will apply.  You must specify the table-name to which the column
 belongs, followed by a period, before the column name.  The named
 column must already be defined and cannot have a storage map
 associated with it.  For each area, you can specify one FOR clause
 and list of table-names and/or table-column names.

TABLE

 CREATE TABLE─┐
 ┌────────────┘
 ├─> table-name ─> ( ─┬┬─> col-definition ─────────┬┬─> ) ─┬─> typebox (;)
 │                    │└─> table-constraint ───────┘│      │
 │                    └───────────── , <────────────┘      │
 └─> 
F

R

O

M
──> path-name ─┬───────────────>────────────────┬┘ └─> 
S

C

H

E

M

A
typebox (A)typebox (U)typebox (T)typebox (H)typebox (O)typebox (R)typebox (I)typebox (Z)typebox (A)typebox (T)typebox (I)typebox (O)typebox (N) auth-id ┘

Additional information available:

More Informationcol definitionFROM clausetable constraint

More Information

 The CREATE TABLE statement creates a table definition.  A table
 definition consists of a list of definitions of columns that make up
 a row in the table.  There are two ways to specify a table definition
 in the CREATE TABLE statement:

  o  Directly, by naming the table, its columns and associated data
     types, default values (optional), constraint definitions
     (optional) and formatting clauses.

  o  Indirectly, by providing a path name for a data dictionary record
     definition that specifies the table name, columns, and data
     types.


 The CREATE TABLE statement also creates a default access privilege
 set for the table.

col definition

 col-definition =

  ─> column-name ──────┐
       ┌───────────────┘
       ├─┬─> data-type ───┬─┬──────────────────┬─┐
       │ └─> domain-name ─┘ └─> default-value ─┘ │
       │ ┌───────────────────────────────────────┘
       │ └┬───────────────────┬─┬───────────────────────┬──────┬─>
       │  └─> col-constraint ─┘ ├─> sql-and-dtr-clause ─┤      │
       │                        └────────────<──────────┘      │
       └──> 
C

O

M

P

U

T

E

D

B

Y
value-expr ─┬──────────────────────┬─┐ │ ├─> 
C

H

E

C

K
(predicate) ─┤ │ │ └─> 
N

O

T

N

U

L

L
─────────┘ │ │ ┌───────────────────────────────────────────────────┘ │ └┬────────────────────────────────┬───────────────────┘ └─> 
C

O

N

S

T

R

A

I

N

T
constraint-name ──┘

Additional information available:

COLLATING_SEQUENCE_ISCOMPUTED_BYCHECKNOT_NULL

More Informationdata typedefault valuevalue exprcol constraintsql and dtr clause

More Information

 The column definition clause specifies a data type or domain name and
 optional default value, column-constraints, SQL and DATATRIEVE
 formatting, and COMPUTED BY clauses for the column specified by the
 column name.

data type

 data-type =

 ──┬─> 
C

H

A

R
─┬────────┬───────────────────────────┬──> │ └─> (n) ─┘ │ ├─> 
V

A

R

C

H

A

R
(n) ───────────────────────────────┤ ├─> 
L

O

N

G

V

A

R

C

H

A

R
──────────────────────────────┤ ├─> 
T

I

N

Y

I

N

T
──────────────┬─────┬────────┬─────┤ ├─> 
S

M

A

L

L

I

N

T
─────────────┤ └─> (n) ─┘ │ ├─> 
I

N

T

E

G

E

R
──────────────┤ │ ├─> 
Q

U

A

D

W

O

R

D
─────────────┤ │ ├─> 
L

I

S

T

O

F

B

Y

T

E

V

A

R

Y

I

N

G
─┘ │ ├─> 
D

E

C

I

M

A

L
─┬─┬─────────────────────────────┬─┤ ├─> 
N

U

M

E

R

I

C
─┘ └─> ( ──> n ─┬────────┬─> ) ──┘ │ │ └─> , n ─┘ │ ├─> 
F

L

O

A

T
─┬────────┬──────────────────────────┤ │ └─> (n) ─┘ │ ├─> 
R

E

A

L
──────────────────────────────────────┤ ├─> 
D

O

U

B

L

E

P

R

E

C

I

S

I

O

N
──────────────────────────┤ └─> 
D

A

T

E
──────────────────────────────────────┘

default value

 default-value =

 DEFAULT ──┬──>literal ─┬───>
           ├──>
U

S

E

R
───┤ └──>
N

U

L

L
───┘

Additional information available:

USERNULLCURRENT_TIMESTAMP

More informationliteralMore Information

More information
 The default value of a column is the value stored in the database if
 an insert operation on a row specifies no value for that column.  You
 can use literals, the NULL keyword, the current timestamp, or the
 user name as default values.  If you do not specify a default value,
 SQL assigns NULL as the default value.

 If you specify a default value for a column in a table, it overrides
 any default value specified for the domain on which the column is
 based.

 You might have any of several possible reasons for specifying a
 default value for a column; for instance, you may want to store the
 most commonly used value, or you may want to store a value that
 highlights (is visual displays) the fact that no value was stored.
literal
 A value expression that is either numeric, character string, or date.
USER
 The user name of the process that invokes interactive SQL or runs a
 program.
NULL
 A null value.
CURRENT_TIMESTAMP
 The date and time currently defined in Rdb/VMS.
More Information
 A value to be stored in a column if the row that is inserted does not
 include a value for that column.  You can use literals, the NULL
 keyword, the current timestamp, or the user name as default values.

 If you do not specify a default value, a column inherits any default
 value from the domain.  If you do not specify a default value for
 either the column or domain, SQL assigns NULL as the default value.

value expr

 value-expr =
 ─┬─┬┬──────┬─┬── column-name ──────────────────────────┬─┬─────────┬>
  │ │├─> typebox (+) ─┤ ├───> 
S

U

M
───┬┬─> (
D

I

S

T

I

N

C

T
column-name) ─┤ ├─> typebox (+) ─┬┐ │ │ │└─> - ─┘ ├───> 
A

V

G
───┤└─> (typebox (A)typebox (L)typebox (L) value-expr) ───────┤ ├─> - ─┤│ │ │ │ ├───> 
M

A

X
───┤ │ ├─> typebox (*) ─┤│ │ │ │ ├───> 
M

I

N
───┘ │ └─> typebox (/) ─┘│ │ │ │ ├───> 
C

O

U

N

T
─┬──> (typebox (*)) ────────────────────┤ │ │ │ │ │ └──> (
D

I

S

T

I

N

C

T
column-name) ─┤ │ │ │ │ ├─> char-value-expr ──────────────────────┤ │ │ │ │ ├─> 
D

B

K

E

Y
────────────────────────────────┤ │ │ │ │ ├─> (value-expr) ─────────────────────────┤ │ │ │ │ └─> 
C

U

R

R

E

N

T

T

I

M

E

S

T

A

M

P
────────────────────┘ │ │ │ └───────────────────────────────────────────────────<─────────┘ │ └──> char-value-expr ──┬──> || ─────> char-value-expr ──┬──────┘ └─────────────────<─────────────────┘ A value expression is a symbol or string of symbols used to represent or calculate a single value. When you use a value expression in the COMPUTED BY clause of a column definition, SQL retrieves or calculates the value associated with the expression and uses that value when executing the statement. See the online HELP topic Value_expression More_Information for more information about value expressions.

Additional information available:

char value expr

char value expr
 char-value-expr =
 ───┬── column-name ─────────────────────────────┬─>
    ├─> literal ─────────────────────────────────┤
    ├─> 
U

S

E

R
────────────────────────────────────┤ ├─> parameter ───────────────────────────────┤ ├─> (col-select-expr) ───────────────────────┤ └─> 
S

U

B

S

T

R

I

N

G
(char-value-expr FROM ──┐ │ ┌───────────────────────────────────┘ │ └> start-position ┬────────────────────┬ ) ┘ └> 
F

O

R
string-length ┘ A character value expression represents a value that belongs to the CHAR, VARCHAR, or LONG VARCHAR data type. You can link two character value expressions together using the concatenation operator.

col constraint

 col-constraint =

 ─┬─> 
P

R

I

M

A

R

Y

K

E

Y
──────────────────────┬──┐ ├─> 
N

O

T

N

U

L

L
─────────────────────────┤ │ ├─> 
U

N

I

Q

U

E
───────────────────────────┤ │ ├─> 
C

H

E

C

K
(predicate) ────────────────┤ │ └─> references-clause ────────────────┘ │ ┌───────────────────────<────────────────┘ └─┬─────────────────>─────────────┬─> └─> 
C

O

N

S

T

R

A

I

N

T
constraint-name ─┘

Additional information available:

char value exprMore Informationreferences clause

char value expr
 char-value-expr =
 ───┬── column-name ─────────────────────────────┬─>
    ├─> literal ─────────────────────────────────┤
    ├─> 
U

S

E

R
────────────────────────────────────┤ ├─> parameter ───────────────────────────────┤ ├─> (col-select-expr) ───────────────────────┤ └─> 
S

U

B

S

T

R

I

N

G
(char-value-expr FROM ──┐ │ ┌───────────────────────────────────┘ │ └> start-position ┬────────────────────┬ ) ┘ └> 
F

O

R
string-length ┘ A character value expression represents a value that belongs to the CHAR, VARCHAR, or LONG VARCHAR data type. You can link two character value expressions together using the concatenation operator.
More Information
 A col-constraint is a constraint definition that applies to the
 specified column.  The five types of column constraints are PRIMARY
 KEY, NOT NULL, UNIQUE, CHECK, and foreign key constraints.  Foreign
 key constraints are created with the REFERENCES clause.  You can also
 optionally specify a name for a constraint definition.

 The PRIMARY KEY column constraint declares a column to be a primary
 key.  SQL requires that values in this column be unique and not null.
 Therefore, you need not specify the UNIQUE and NOT NULL column
 constraints for a primary key column.

 The NOT NULL column constraint restricts values in the column to
 non-null values.

 The UNIQUE column constraint specifies that values in the column
 named must be unique.  You can use either the UNIQUE or PRIMARY KEY
 keywords to define a column as a unique key for a table.

 The CHECK column constraint specifies a predicate that column values
 inserted into the table must satisfy.  Predicates in CHECK table
 constraints can refer directly only to the column with which they are
 associated.

 The optional CONSTRAINT constraint-name specifies a name for a column
 constraint that is used in several ways:

  o  The INTEG_FAIL error message specifies the name when an INSERT,
     UDPATE, or DELETE statement violates the constraint

  o  ALTER TABLE DROP CONSTRAINT statements specify the name to drop a
     table constraint

  o  SHOW TABLE statements display the names of column and table
     constraints


 The name of the constraint is used in error messages and ALTER TABLE
 DROP CONSTRAINT, SHOW TABLE, DECLARE TRANSACTION and SET TRANSACTION
 statements.  The CONSTRAINT clause is optional.  If you omit the
 constraint name, SQL creates a name.  However, DIGITAL recommends
 that you always name column and table constraints.  The constraint
 names generated by SQL may be obscure and, in programs, may change
 between compilation and running.
references clause
 references-clause =

 REFERENCES referenced-table-name ───┐
  ┌─────────────────<────────────────┘
  └─┬─────────────────────>───────────────────┬─>
    └─> ( ─┬─> referenced-column-name ─┬─> ) ─┘
           └─────────── , <────────────┘

 Specifies the name of a column or columns that are a primary key or
 unique key in the referenced table.  When the REFERENCES clause is
 selected as a column-constraint, the column specified in the
 col-definition clause becomes a foreign key for the referencing table
 (the table being defined).  When the REFERENCES clause is selected as
 a table constraint, the column name or column names specified in the
 FOREIGN KEY clause become a foreign key for the referencing table.

 The referenced_table_name is the name of the table that contains the
 unique key or primary key referenced by the referencing table.  You
 must have the SQL access right REFERENCES or CREATETAB to the
 referenced table.

 For a column constraint, the referenced_column_name is the name of
 the column that is a unique key or primary key in the referenced
 table.  For a table constraint, the referenced_column_name is the
 name of the column or columns that are a unique key or primary key in
 the referenced table.  If you do not supply a referenced_column_name,
 the primary key is selected by default.

sql and dtr clause

 sql-and-dtr-clause =

 ─┬─> 
Q

U

E

R

Y

H

E

A

D

E

R
typebox (I)typebox (S) ─┬> quoted-string ──┬─────────────────┬─> │ └────── typebox (/) <────────┘ │ ├─> 
E

D

I

T

S

T

R

I

N

G
typebox (I)typebox (S) quoted-string ─────────────────────────┤ │ │ ├─> 
Q

U

E

R

Y

N

A

M

E
Ftypebox (O)typebox (R) ─┬─> typebox (D)typebox (T)typebox (R) ────────┬─> typebox (I)typebox (S) quoted-string ─┤ │ └─> typebox (D)typebox (A)typebox (T)typebox (A)typebox (T)typebox (R)typebox (I)typebox (E)typebox (V)typebox (E) ─┘ │ ├─> 
D

E

F

A

U

L

T

V

A

L

U

E
Ftypebox (O)typebox (R) ─┬─> typebox (D)typebox (T)typebox (R) ────────┬─> typebox (I)typebox (S) literal ────┤ │ └─> typebox (D)typebox (A)typebox (T)typebox (A)typebox (T)typebox (R)typebox (I)typebox (E)typebox (V)typebox (E) ─┘ │ ├─> 
N

O

Q

U

E

R

Y

H

E

A

D

E

R
──────────────────────────────────────┤ ├─> 
N

O

E

D

I

T

S

T

R

I

N

G
───────────────────────────────────────┤ ├─> 
N

O

Q

U

E

R

Y

N

A

M

E
────┬──> Ftypebox (O)typebox (R) ─┬─> typebox (D)typebox (T)typebox (R) ────────┬─────────┘ └─> 
N

O

D

E

F

A

U

L

T

V

A

L

U

E
─┘ └─> typebox (D)typebox (A)typebox (T)typebox (A)typebox (T)typebox (R)typebox (I)typebox (E)typebox (V)typebox (E) ─┘ Optional formatting clauses allow you to modify data displays or query characteristics for interactive SQL users and DATATRIEVE users. A query header specifies a string that interactive SQL or DATATRIEVE displays in place of the column name when it retrieves values from a column. An edit string specifies a string that controls how interactive SQL or DATATRIEVE formats the display of values in a column. DEFAULT VALUE and QUERY NAME are active only from DATATRIEVE.

COLLATING_SEQUENCE_IS

 The COLLATING SEQUENCE IS clause specifies a collating sequence.

 A collating sequence is the sequence in which characters are ordered
 for sorting, merging, and comparing.  The VMS National Character Set
 (NCS) provides a set of predefined collating sequences and lets you
 define collating sequences of your own.

COMPUTED_BY

 The COMPUTED BY clause specifies that the value of this column is
 calculated from values in other columns and constant expressions.
 You can use the COMPUTED BY clause in a CREATE TABLE or an ALTER
 TABLE statement.
 In a COMPUTED BY clause, the column name that you supply in your
 column definition must be different from the name of any other
 existing column in the table.
 Any column that you refer to in the definition of a computed column
 cannot be deleted from that table unless you first delete the
 computed column.
 SQL does not allow UNIQUE or PRIMARY KEY constraints, REFERENCE
 clauses, default values, or default values for DATATRIEVE in computed
 columns.

CHECK

 The CHECK column constraint specifies a predicate that column values
 inserted into the table must satisfy.  Predicates in CHECK table
 constraints can refer directly only to the column with which they are
 associated.

NOT_NULL

 The NOT NULL column constraint restricts values in the column to
 non-null values.

FROM clause

 The FROM clause specifies the data dictionary path name of a
 dictionary record definition.  SQL creates the table and all
 associated columns using the definition from this field.

 You can specify either a full data dictionary path name or a relative
 data dictionary path name.

 You cannot specify support clauses for SQL or DATATRIEVE or
 constraints if you use the FROM path-name form of the CREATE TABLE
 statement.

Additional information available:

authorization id

authorization id

 A name for an attachment to a particular database.  SQL adds the
 table definition to the database referred to by the authorization
 identifier.

 If you do not specify an authorization identifier, SQL adds the table
 definition to the default schema.

table constraint

 table-constraint =

 ─┬─> 
P

R

I

M

A

R

Y

K

E

Y
─> ( ─┬─> column-name ─┬─> ) ──────┬──┐ │ └─────── , <─────┘ │ │ ├─> 
U

N

I

Q

U

E
─> ( ─┬─> column-name ─┬─> ) ───────────┤ │ │ └─────── , <─────┘ │ │ ├─> 
C

H

E

C

K
(predicate) ─────────────────────────────┤ │ └─> 
F

O

R

E

I

G

N

K

E

Y
─> ( ─┬─> column-name ─┬─> ) ──┐ │ │ └─────── , <─────┘ │ │ │ ┌───────────────────────<────────────────────┘ │ │ └─> references-clause ─────────────>─────────────┘ │ ┌──────────────────<────────────────────────────────┘ └─┬───────────────────────────────┬─> └─> 
C

O

N

S

T

R

A

I

N

T
constraint-name ─┘

Additional information available:

More Informationreferences clause

More Information

 A table-constraint is a constraint definition that applies to the
 whole table.  The four types of table constraints are PRIMARY KEY,
 UNIQUE, CHECK, and FOREIGN KEY constraints.  You can also optionally
 specify a constraint name.  A column must be defined in a table
 before you can specify the column in a table constraint definition.

 The PRIMARY KEY constraint is used to declare a column or columns as
 a primary key for the table being defined.  Any foreign key that
 refers to this column must refer to this primary key.

 The UNIQUE table constraint specifies that the combination of values
 for the columns named must be unique in a row.  You can use either
 the UNIQUE or PRIMARY KEY keywords to define one or more columns as a
 unique key for a table.

 The CHECK table constraint specifies a predicate that column values
 inserted into the table must satisfy.  Predicates in CHECK table
 constraints can refer to any column in the table.  Column select
 expressions within the predicate can refer to other tables in the
 schema.

 The FOREIGN KEY table constraint specifies the column or columns that
 you want to declare as a foreign key in the table you are defining.

 The optional CONSTRAINT constraint-name clause specifies a name for a
 column or table constraint.  The name specified is used in several
 ways:

  o  The INTEG_FAIL error message specifies the name when an INSERT,
     UDPATE, or DELETE statement violates the constraint

  o  ALTER TABLE DROP CONSTRAINT statements specify the name to drop a
     table constraint

  o  SHOW TABLE statements display the names of column and table
     constraints

references clause

 references-clause =

 REFERENCES referenced-table-name ───┐
  ┌─────────────────<────────────────┘
  └─┬─────────────────────>───────────────────┬─>
    └─> ( ─┬─> referenced-column-name ─┬─> ) ─┘
           └─────────── , <────────────┘

 Specifies the name of a column or columns that are a primary key or
 unique key in the referenced table.  When the REFERENCES clause is
 selected as a column-constraint, the column specified in the
 col-definition clause becomes a foreign key for the referencing table
 (the table being defined).  When the REFERENCES clause is selected as
 a table constraint, the column name or column names specified in the
 FOREIGN KEY clause become a foreign key for the referencing table.

 The referenced_table_name is the name of the table that contains the
 unique key or primary key referenced by the referencing table.  You
 must have the SQL access right REFERENCES or CREATETAB to the
 referenced table.

 For a column constraint, the referenced_column_name is the name of
 the column that is a unique key or primary key in the referenced
 table.  For a table constraint, the referenced_column_name is the
 name of the column or columns that are a unique key or primary key in
 the referenced table.  If you do not supply a referenced_column_name,
 the primary key in the referenced table is used by default.

TRIGGER

 CREATE TRIGGER ──> trigger-name ──┐
 ┌────────────────<────────────────┘
 └┬─> 
B

E

F

O

R

E
─┬─┬─> 
I

N

S

E

R

T
────────────────────────────────┬─┐ └─> 
A

F

T

E

R
──┘ ├─> 
D

E

L

E

T

E
────────────────────────────────┤ │ └─> 
U

P

D

A

T

E
──┬──────────────────────────┬──┘ │ └──> 
O

F
─┬─> column-name ─┬┘ │ └─── , <─────────┘ │ ┌────────────────────────────────<──────────────────────────┘ └─> 
O

N
table-name ─┬────────────>──────────┬┬─> triggered-action ─┬>typebox (;) └─> referencing-clause ─┘└───────────<─────────┘

Additional information available:

More Informationtrigger namecolumn nametable namereferencing clause
triggered action

More Information

 The CREATE TRIGGER statement creates a trigger for the specified
 table.  A trigger defines the actions to occur before or after an
 update of the table in order to maintain the referential integrity of
 the database.  A trigger can be thought of as a constraint on a
 single table, which takes effect at a specific time for a particular
 type of update and causes a series of triggered actions to be
 performed.

 With triggers, you can define the rules and actions necessary to
 manage updates and deletions of rows containing unique keys or
 primary keys that are referred to by foreign keys.

 Creating a trigger requires SELECT and CREATETAB access to the
 subject table, and if any triggered statement specifies some form of
 update operation, requires SELECT, DBCTRL, and the appropriate type
 of update (DELETE, UPDATE, INSERT) access to the tables specified by
 the triggered action statement.

 You must execute this statement in a read/write transation.  If you
 issue this statement when there is no active transaction, SQL starts
 a read/write transaction implicitly.

 Other users are allowed to be attached to the database when you issue
 the CREATE TRIGGER statement.

trigger name

 The name of the trigger being defined.  The name must be unique
 within the database.

column name

 The name of the column within the specified table to be checked for
 deletion, modification, or insertion.  This argument is only used
 with UPDATE triggers.

table name

 The name of the table for which this trigger is defined.

referencing clause

 referencing-clause =

 REFERENCING ──┬─┬─> 
O

L

D
typebox (A)typebox (S) ──> old-alias ──┬─┬──> │ └─> 
N

E

W
typebox (A)typebox (S) ──> new-alias ──┘ │ └──────────────<───────────────┘

Additional information available:

More Information

More Information

 The REFERENCING clause permits you to specify whether you want to
 reference the row values as they existed before an UPDATE operation
 occurred or the new row values after they have been applied by the
 UPDATE operation.  Do not use this clause with INSERT or DELETE
 operations.

 You can specify each option (OLD AS old-alias and NEW AS new-alias)
 only once in the REFERENCING clause.

Additional information available:

old aliasnew alias

old alias
 A temporary name used to refer to the row values as they existed
 before an UPDATE operation occurred.
new alias
 A temporary name used to refer to the new row values to be applied by
 the UPDATE operation.

triggered action

 triggered-action =

 ───┬─────────>────────┬─> ( ─┬> triggered-statement ─┬─> ) ─┐
    └> 
W

H

E

N
predicate ─┘ └─────────── ,<─────────┘ │ ┌─────────────────────────────<──────────────────────────┘ └─┬────────>────────┬─> └─> 
F

O

R

E

A

C

H

R

O

W
─┘

Additional information available:

triggered statementMore Information

triggered statement

 triggered-statement =

 ──┬─> delete-statement ─┬──>
   ├─> update-statement ─┤
   ├─> insert-statement ─┤
   └─> 
E

R

R

O

R
────────────┘ A statement that updates the schema or generates an error message.

Additional information available:

ERROR

delete statementupdate statementinsert statement

delete statement
 A DELETE statement that specifies the row of a table or view that you
 want to delete.  You will receive an error message if you specify
 CURRENT OF cursor-name with the DELETE statement's WHERE clause.
update statement
 An UPDATE statement that specifies the row of a table or view that
 you want to modify.  You will receive an error message if you specify
 CURRENT OF cursor-name with the UPDATE statement's WHERE clause.
insert statement
 An INSERT statement that specifies the new row or rows you want to
 add to a table or view.
ERROR
 A triggered ERROR statement provides the following message:

 RDMS-E-TRIG_ERROR, Trigger 'trigger_name' forced an ERROR.

More Information

 Consists of an optional predicate and some number of triggered
 statements.  If specified, the predicate must evaluate to true in
 order for the triggered statements in the trigger action clause to
 execute.  Each triggered statement is executed in the order in which
 it appears within the triggered action definition.

 The FOR EACH ROW clause determines whether the triggered action is
 evaluated once per triggering statement, or for each row of the
 subject table that is affected by the triggering statement.  If the
 FOR EACH ROW clause is not specified, the triggered action is
 evaluated only once, and row values are not available to the
 triggered action.

VIEW

 CREATE VIEW ──> view-name ──┐
   ┌─────────────────────────┘
   └┬────────────────────────>─────────────────────────────────────┬───┐
    └─> ( ─┬─> column-name ──┬─┬───────────────>────────┬─┬─┬─> ) ─┘   │
           │                 │ └─> sql-and-dtr-clause ──┘ │ │          │
           │                 └─────────<──────────────────┘ │          │
           └──────────────── , <────────────────────────────┘          │
   ┌───────────────────────────────────────────────────────────────────┘
   └─> 
A

S
select-expr ┬──────>────────────┬──>──┬────────────────────┬─┐ └─>order-by-clause ─┘ └─> limit-to-clause ─┘ │ ┌───────────────────────────────────────────────────────────────────┘ │ └─┬───────────────────────┬─> typebox (;) └─>check-option-clause ─┘

Additional information available:

More Informationselect exprsql and dtr clauseorder by clause
limit to clausecheck option clause

More Information

 The CREATE VIEW statement defines a view.  A view is a table whose
 data is not physically stored.  Rather, a view is a virtual structure
 that refers to rows stored in other tables.  When the CREATE VIEW
 statement executes, it adds a view definition to the schema and, if
 the schema was declared by path name, to the data dictionary.  The
 CREATE VIEW statement also creates a default access privilege set for
 the view.

 Select More_Information to continue.

Additional information available:

More Information

More Information

 Do not refer to read-only views in INSERT, UPDATE, or DELETE
 statements.  SQL considers as read-only views those with select
 expressions that:

  o  Use the DISTINCT argument to eliminate duplicate rows from the
     result table

  o  Name more than one table or view in the FROM clause

  o  Specify a subquery in the predicate of the WHERE clause

  o  Include a function in the select list

  o  Contain a GROUP BY or HAVING clause

select expr

 select-expr =

 ───┬─┬─> select-clause ─────┬───>
    │ └─>( select-expr ) ────┤
    │ ┌─────────<────────────┘
    │ └─>
U

N

I

O

N
─┬───────┬────┐ │ └─>
A

L

L
─┘ │ └───────<────────────────┘

Additional information available:

UNION

select clauseMore Information

select clause

 select-clause =

 SELECT ─┬──────>──────┬─> select-list ──┐
         ├─> 
A

L

L
──────┤ │ └─> 
D

I

S

T

I

N

C

T
─┘ │ ┌──────────────────────────────<──────┘ └ 
F

R

O

M
─┬┬─> table-name ─┬─┬─────>────┬─┬─┬─────────>──────────┬─┐ │└─> view-name ──┘ └─> alias ─┘ │ └─> 
W

H

E

R

E
predicate ─┘ │ └────────── , <─────────────────┘ │ ┌──────────────────────────────<─────────────────────────────────┘ └┬─────────────>──────────────────┬─┬──────────>──────────┬──> └─> 
G

R

O

U

P

B

Y
─┬─> column-name ─┬─┘ └─> 
H

A

V

I

N

G
predicate ─┘ └─────── , <─────┘

UNION

 The union operator merges the results of a select expression or
 select clause with another select expression or select clause into
 one result table by appending the values of columns in one table with
 the values of columns in other tables.

Additional information available:

ALL

ALL
 The ALL qualifier specifies that duplicate rows should not be
 eliminated from the result table.

More Information

 A select expression is an expression that defines which columns and
 rows of which tables SQL includes in the view.  The select expression
 can name only tables in the same database as the view.

sql and dtr clause

 sql-and-dtr-clause =

 ─┬─> 
Q

U

E

R

Y

H

E

A

D

E

R
typebox (I)typebox (S) ─┬> quoted-string ──┬─────────────────┬─> │ └────── typebox (/) <────────┘ │ ├─> 
E

D

I

T

S

T

R

I

N

G
typebox (I)typebox (S) quoted-string ─────────────────────────┤ │ │ ├─> 
Q

U

E

R

Y

N

A

M

E
Ftypebox (O)typebox (R) ─┬─> typebox (D)typebox (T)typebox (R) ────────┬─> typebox (I)typebox (S) quoted-string ─┤ │ └─> typebox (D)typebox (A)typebox (T)typebox (A)typebox (T)typebox (R)typebox (I)typebox (E)typebox (V)typebox (E) ─┘ │ ├─> 
D

E

F

A

U

L

T

V

A

L

U

E
Ftypebox (O)typebox (R) ─┬─> typebox (D)typebox (T)typebox (R) ────────┬─> typebox (I)typebox (S) literal ────┤ │ └─> typebox (D)typebox (A)typebox (T)typebox (A)typebox (T)typebox (R)typebox (I)typebox (E)typebox (V)typebox (E) ─┘ │ ├─> 
N

O

Q

U

E

R

Y

H

E

A

D

E

R
──────────────────────────────────────┤ ├─> 
N

O

E

D

I

T

S

T

R

I

N

G
───────────────────────────────────────┤ ├─> 
N

O

Q

U

E

R

Y

N

A

M

E
────┬──> Ftypebox (O)typebox (R) ─┬─> typebox (D)typebox (T)typebox (R) ────────┬─────────┘ └─> 
N

O

D

E

F

A

U

L

T

V

A

L

U

E
─┘ └─> typebox (D)typebox (A)typebox (T)typebox (A)typebox (T)typebox (R)typebox (I)typebox (E)typebox (V)typebox (E) ─┘ Optional formatting clauses allow you to modify data displays or query characteristics for interactive SQL users and DATATRIEVE users. A query header specifies a string that interactive SQL or DATATRIEVE displays in place of the column name when it retrieves values from a column. An edit string specifies a string that controls how interactive SQL or DATATRIEVE formats the display of values in a column. DEFAULT VALUE and QUERY NAME are active only from DATATRIEVE.

order by clause

 order-by-clause =

 ──> 
O

R

D

E

R

B

Y
─┬┬─> column-name ─┬─┬────>────┬─┬──> │└─> integer ─────┘ ├─> 
A

S

C
──┤ │ │ └─> 
D

E

S

C
─┘ │ └──────────── , <───────────────┘

limit to clause

 limit-to-clause =

 ───> 
L

I

M

I

T

T

O
────> row-limit ───> 
R

O

W

S
──>

check option clause

 check-option-clause =

 WITH CHECK OPTION ──┬──────────────>─────────────────┬───>
                     └─>
C

O

N

S

T

R

A

I

N

T
check-option-name ─┘ The check option clause places restrictions on updates made to a view. This clause ensures that any rows that are inserted or updated in a view conform to the definition of the view. Do not specify the check option clause with views that are read-only.

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026