Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

DOMAIN

INDEX

SCHEMA

STORAGE_MAP

TABLE

COLLATING_SEQUENCE_IS

NO_COLLATING_SEQUENCE

More Information

default value

sql and dtr clause

USER

NULL

CURRENT_TIMESTAMP

literal

More information

More Information

index store clause

More Information

ADD_STORAGE_AREA

ALTER_STORAGE_AREA

DROP_STORAGE_AREA

alter root file params1

alter root file params2

alter storage area params

More Information

storage area params

READ_ONLY

READ_WRITE

More Information

More Information

READ_ONLY

READ_WRITE

More Information

extension options

More Information

More Information

store clause

More Information

ADD_COLUMN

ADD_CONSTRAINT

ALTER_COLUMN

DROP_COLUMN

DROP_CONSTRAINT

More Information

COLLATING_SEQUENCE_IS

data type

default value

col constraint

sql and dtr clause

USER

NULL

CURRENT_TIMESTAMP

More information

literal

More Information

More Information

references clause

COLLATING_SEQUENCE_IS

More Information

data type

default value

add col constraint

sql and dtr clause

USER

NULL

CURRENT_TIMESTAMP

More information

literal

More Information

More Information

references clause

RDB/VMS SQL ALTER — VMS RDB_4.0

 Changes definitions for VAX SQL.

Additional information available:

DOMAININDEXSCHEMASTORAGE_MAPTABLE

DOMAIN

 ALTER DOMAIN ----+
  +---------------+
  +->domain-name +-----------------+-+-----------------+--+
                 +-> IS data-type -+ +->default-value -+  |
  +-------------------------------------------------------+
  +-+--------------------------------------------+--+
    +---> COLLATING SEQUENCE IS sequence-name ---+  |
    +---> NO COLLATING SEQUENCE -----------------+  |
          +-----------------------------------------+
          +--+--------------------------+--> ;
             ++-> sql-and-dtr-clause --++
              +-------<----------------+

Additional information available:

COLLATING_SEQUENCE_ISNO_COLLATING_SEQUENCE

More Informationdefault valuesql and dtr clause

More Information

 Alters a domain definition.  This allows you to change the data type,
 optional default value, collating sequence, or SQL and DATATRIEVE
 formatting parameters for all columns defined using the domain,
 simply by changing the domain itself.  For example, if you want to
 change the data type for EMPLOYEE_ID from CHAR(5) to CHAR(6), you
 need only alter the data type for ID_DOM.  You do not have to alter
 the data type for the column EMPLOYEE_ID in the tables DEGREES,
 EMPLOYEES, JOB_HISTORY, SALARY_HISTORY, nor do you have to alter the
 column MANAGER_ID in DEPARTMENTS.

 You can alter any named domain once you have declared the schema that
 includes the domain.  If you want to alter a domain that is referred
 to in an index definition, you must first drop the index.

 If a domain definition is stored in the data dictionary, the ALTER
 DOMAIN statement alters the domain definition in the data dictionary.

default value

 default-value =

 DEFAULT --+-->literal -+--->
           +-->USER  ---+
           +-->NULL  ---+

Additional information available:

USERNULLCURRENT_TIMESTAMP

literalMore information

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

 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.

COLLATING_SEQUENCE_IS

 Specifies a new collating sequence for the named domain.

 The VMS National Character Set (NCS) Utility provides a set of
 pre-defined collating sequences and also lets you define collating
 sequences of your own.  The COLLATING SEQUENCE clause accepts both
 pre-defined and user-defined NCS collating sequences.

 Before you use the COLLATING SEQUENCE clause in an ALTER DOMAIN
 statement, you must first specify the NCS collating sequence for SQL
 using the CREATE COLLATING SEQUENCE statement.  The sequence-name
 argument in the COLLATING SEQUENCE clause must be the same as the
 sequence-name in the CREATE COLLATING SEQUENCE statement

NO_COLLATING_SEQUENCE

 Specifies that the named domain will use the standard default
 collating sequence:  that is, ASCII.  Use the NO COLLATING SEQUENCE
 clause to override the collating sequence defined for the schema in
 the CREATE SCHEMA or ALTER SCHEMA statement, or the domain in the
 CREATE DOMAIN statement.

sql and dtr clause

 sql-and-dtr-clause =

 -+-> QUERY HEADER IS -+> quoted-string --+-----------------+->
  |                    +------ / <--------+                 |
  +-> EDIT STRING IS quoted-string -------------------------+
  |                                                         |
  +-> QUERY NAME FOR -+-> DTR --------+-> IS quoted-string -+
  |                   +-> DATATRIEVE -+                     |
  +-> DEFAULT VALUE FOR -+-> DTR --------+-> IS literal ----+
  |                      +-> DATATRIEVE -+                  |
  +-> NO QUERY HEADER --------------------------------------+
  +-> NO EDIT STRING ---------------------------------------+
  +-> NO QUERY NAME ----+--> FOR -+-> DTR --------+---------+
  +-> NO DEFAULT VALUE -+         +-> DATATRIEVE -+

 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

 ALTER INDEX index-name -+
 +-----------------------+
 +-+--------------------------------+-+-----------------------+-> ;
   +++-> NODE SIZE number-bytes --+++ +-> index-store-clause -+
    |+-> PERCENT FILL percentage -+|
    |+-> USAGE -+-> UPDATE -+-----+|
    |           +-> QUERY --+      |
    +----------------<-------------+

Additional information available:

More Informationindex store clause

More Information

 Changes an index.  The ALTER INDEX statement allows you to change:

  o  The characteristics of index nodes (sorted indexes only)

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


 You cannot change:

  o  The columns that comprise an index

  o  Whether the index is UNIQUE

  o  A hashed to a sorted index

  o  A sorted index to a hashed index


 You cannot alter an index when there are other active users of the
 database.

index store clause

 index-store-clause = STORE -+
 +---------------------------+
 +-> IN area-name -------------------------------------------------+->
 +-> USING -> ( -+-> column-name -+-> ) -+                         |
                 +------ , <------+      |                         |
  +--------------------------------------+                         |
  ++-> IN area-name WITH LIMIT OF -> ( -+- literal -+-> ) -+-+     |
   |                                    +---- , <---+      | |     |
   +-------------------------- <---------------------------+ |     |
  +----------------------------------------------------------+     |
  +-> OTHERWISE IN 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

 ALTER SCHEMA -+-> PATHNAME path-name -+--+
               +-> FILENAME file-spec -+  |
 +--------------------<-------------------+
 +-+------------->--------------+-+-------------->-------------+-+
   +-> alter-root-file-params1 -+ +-> alter-root-file-params2 -+ |
 +---------------------------------------------------------------+
 +-+-------------->----------------+--+
   +-> alter-storage-area-params --+  |
 +----------------<-------------------+
 +-++--------------------------->-------------------------------++-> ;
   |+-> ADD STORAGE AREA area-name -+-----------> ----------+-+ ||
   ||                               +-> FILENAME file-spec -+ | ||
   ||   +----------------------- <----------------------------+ ||
   ||   +-> storage-area-params --------------------------------+|
   |+-> ALTER STORAGE AREA area-name alter-storage-area-params -+|
   |+-> DROP STORAGE AREA area-name ----------------------------+|
   +------------------------------<------------------------------+

Additional information available:

ADD_STORAGE_AREAALTER_STORAGE_AREADROP_STORAGE_AREA

alter root file params1alter root file params2alter storage area paramsMore Information
storage area params

ADD_STORAGE_AREA

 Specifies the name and file specification for a storage area you want
 to add to the schema.  You can use the ADD STORAGE AREA clause only
 on multifile databases.  The area name cannot be the same as any
 other storage area definition in the schema.

 The ADD STORAGE AREA clause creates two files, a data file with a
 file extension of .RDS and a snapshot file with a file extension of
 .SNP.  If you omit the FILENAME argument, the file specification
 takes the following defaults:

  o  Device:  the current device for the process

  o  Directory:  the current device for the process

  o  File name:  the name specified for the storage area


 The file specification is used for both the data and snapshot files
 that comprise the storage area (unless you use the SNAPSHOT FILENAME
 argument to specify a different file for the snapshot file).  Because
 the ADD STORAGE AREA clause may create two files with different file
 extensions, do not specify a file extension with the file
 specification.

ALTER_STORAGE_AREA

 Specifies the name of an existing storage area in the schema that you
 want to alter.  You can use the ALTER STORAGE AREA clause only on
 multifile databases.

 The alter-storage-area-params are parameters that the ALTER STORAGE
 AREA clause changes.

alter root file params1

 alter-root-file-params1 =

 -+-+-+-> OPEN IS ------------+--> AUTOMATIC  -+---------------+-+-+->
  | | |                       +--> MANUAL -----+               | | |
  | | +-> READ WRITE ------------------------------------------+ | |
  | | +-> NUMBER OF USERS IS --> number-users -----------------+ | |
  | | +-> NUMBER OF BUFFERS IS -----> number-buffers ----------+ | |
  | | +-> NUMBER OF VAXCLUSTER NODES IS --> number-nodes ------+ | |
  | | +-> NUMBER OF RECOVERY BUFFERS IS --> number-buffers ----+ | |
  | | +-> SNAPSHOT IS --+-> ENABLED -+------->------+-+--------+ | |
  | |                   |            +-> IMMEDIATE -+ |          | |
  | |                   |            +-> DEFERRED --+ |          | |
  | |                   +-> DISABLED -------->--------+          | |
  | +----------------------------<-------------------------------+ |
  +-----> READ ONLY ------------->---------------------------------+

Additional information available:

READ_ONLYREAD_WRITE

More Information

More Information

 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.

 Note that ALTER SCHEMA does not allow you to change all root file
 parameters you can specify in CREATE SCHEMA.  You must use the EXPORT
 and IMPORT statements to change the following root file parameters:

  o  BUFFER SIZE

  o  NUMBER OF USERS (for a single-file database)

  o  NUMBER OF VAXCLUSTER NODES (for a single-file database)

  o  SEGMENTED STRING STORAGE AREA

  o  PROTECTION IS ANSI PROTECTION IS ACL

READ_ONLY

 Use the READ ONLY option to change a read/write RDB$SYSTEM storage
 area (and the Rdb/VMS system relations stored in the area) to
 read-only.  You might choose the READ ONLY option if your database is
 never or rarely updated.  When the RDB$SYSTEM storage area is changed
 to read-only, locking conflicts occur less frequently, and the
 automatic updating of index and relation cardinality is inhibited.

 For information on changing a read/write storage area other than the
 RDB$SYSTEM storage area to read-only, see the "READ_ONLY" subtopic
 for "alter_storage_area_params".

READ_WRITE

 Use the READ WRITE option to change a read-only RDB$SYSTEM storage
 area (and the Rdb/VMS system relations stored in the area) to
 read/write.

 For information on changing a read/only storage area other than the
 RDB$SYSTEM storage area to read/write, see the "READ_WRITE" subtopic
 for "alter_storage_area_params".

alter root file params2

 alter-root-file-params2 =

 ---+-+-> DICTIONARY IS ------+-> REQUIRED -------+------------+-+-->
    | |                       +-> NOT REQUIRED ---+            | |
    | +-> ADJUSTABLE LOCK GRANULARITY IS -+-> ENABLED --+------+ |
    | |                                   +-> DISABLED -+      | |
    | +-> JOURNAL FILENAME file-spec --------------------------+ |
    | +-> JOURNAL ALLOCATION IS -> journal-blocks -> BLOCKS ---+ |
    | +-> JOURNAL EXTENT IS ---> extent-blocks --> BLOCKS -----+ |
    | +-> NO JOURNAL ------------------------------------------+ |
    +------------------------------<-----------------------------+

Additional information available:

More Information

More Information

 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.

 Note that ALTER SCHEMA does not allow you to change all root file
 parameters you can specify in CREATE SCHEMA.  You must use the EXPORT
 and IMPORT statements to change the following root file parameters:

  o  BUFFER SIZE

  o  NUMBER OF USERS (for a single-file database)

  o  NUMBER OF VAXCLUSTER NODES (for a single-file database)

  o  SEGMENTED STRING STORAGE AREA

  o  PROTECTION IS ANSI PROTECTION IS ACL

alter storage area params

 alter-storage-area-params =

 -+-+-+-> READ WRITE -------------------------------------+-+-+->
  | | +-> EXTENT IS -+> extent-pages ---------> PAGES --+-+ | |
  | | |              +> (extension-options) ------------+ | | |
  | | +-> SNAPSHOT ALLOCATION IS -> snp-pages --> PAGES --+ | |
  | | +-> SNAPSHOT EXTENT IS  +> extent-pages -> PAGES -+-+ | |
  | |                         +> (extension-options) ---+   | |
  | +-----------------------------<-------------------------+ |
  +-----> READ ONLY ------------------------------------------+

Additional information available:

READ_ONLYREAD_WRITE

More Informationextension options

More Information

 Parameters that change the characteristics of database storage area
 files.  You can specify the same storage area parameters for either
 single-file or multifile databases, but the effect of the clauses in
 this part of an ALTER SCHEMA statement differs:

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

  o  For multifile databases, the storage area parameters change the
     characteristics of the RDB$SYSTEM storage area.  SQL generates an
     error if you specify RDB$SYSTEM as the area name in the ALTER
     STORAGE AREA clause, so specifying the parameters in this part of
     the ALTER SCHEMA statement is the only way to change the
     parameters of the RDB$SYSTEM storage area using ALTER SCHEMA.


 Note that ALTER SCHEMA does not allow you to change all storage area
 parameters you can specify in CREATE SCHEMA.  You must use the EXPORT
 and IMPORT statements to change the following root file parameters:

  o  ALLOCATION

  o  PAGE SIZE

  o  PAGE FORMAT

  o  THRESHOLDS

  o  INTERVAL

  o  SNAPSHOT FILENAME

READ_ONLY

 Permits you to change any read/write storage area (except the
 RDB$SYSTEM storage area) to read-only.

 For information on changing a read/write RDB$SYSTEM storage area to
 read-only, see the "READ_ONLY" subtopic for
 "alter_root_file_params1".

Additional information available:

More Information

More Information
 SQL provides support for both read-only databases and databases with
 one or more read-only storage areas.  You can take advantage of this
 read-only support if you have a stable body of data that is never (or
 rarely) updated.

 Read-only databases consist of:

  o  A read/write root file

  o  One or more read-only storage areas and no read/write storage
     areas


 Read-only databases can be published and distributed on CDROM media.

 Read-only storage areas:

  o  Do not have snapshot files (since data in a read-only storage
     area is not updated)

  o  Minimize locking problems in the read-only storage areas

  o  Are not backed up by RMU/BACKUP unless explicitly instructed
     (thus decreasing backup time for large areas of data that do not
     change)

  o  Are not restored by RMU/RESTORE unless explicitly instructed

  o  Are not recovered by RMU/RECOVER


 If you change a read/write storage area to read-only, you cannot
 specify the EXTENT, SNAPSHOT ALLOCATION, and SNAPSHOT EXTENT clauses.

 A database with both read/write and read-only storage areas can be
 fully recovered after a system failure ONLY if after-image journaling
 is enabled on the database.  If your database has both read/write and
 read-only storage areas but does not have after-image journaling
 enabled, you should do full backups (including read-only areas) at
 all times.  Doing full backups enables you to recover the entire
 database to its condition at the time of the previous backup.

 You must convert and remaster read-only storage areas with each
 upgrade of Rdb/VMS.

READ_WRITE

 Permits you to change any read-only storage area (except the
 RDB$SYSTEM storage area) to read/write.  You might change a read-only
 storage area to read/write to facilitate batch updates to
 infrequently changed data.

 For information on changing a read-only RDB$SYSTEM storage area to
 read/write, see the "READ_WRITE" subtopic for
 "alter_root_file_params1".

extension options

 extension-options =

 --> MINIMUM OF min-pages PAGES, -+
 +--------------------------------+
 +-> MAXIMUM OF max-pages PAGES, +
 +-------------------------------+
 +-> PERCENT GROWTH IS growth -->

 Changes the number of pages of each snapshot or storage area file
 extent.

DROP_STORAGE_AREA

 Deletes the specified storage area definition and the associated data
 and snapshot files.  You can use the DROP STORAGE AREA clause only on
 multifile databases.

 To protect against accidental data deletion, the ALTER SCHEMA
 statement fails if you specify a DROP STORAGE AREA clause that names
 a storage area referred to in any storage map.  You must first use
 the ALTER STORAGE MAP statement to move the data to another storage
 area.

More Information

 Alters a schema in any of the following ways:

  o  For both single-file and multifile databases, changes
     characteristics of the database root file associated with a
     schema.  ALTER SCHEMA allows you to override certain
     characteristics specified in the root file parameters of a CREATE
     SCHEMA statement, such as whether a snapshot file is disabled.
     In addition, ALTER SCHEMA lets you control other characteristics
     you cannot specify in CREATE SCHEMA root file parameters, such as
     whether after-image journaling is enabled.

  o  For both single-file and multifile databases, changes storage
     area parameters.

  o  For multifile databases only, adds, alters, or drops storage
     areas.

storage area params

 storage-area-params =

 -+-+-------------------------->-----------------------------+-+-->
  | +-> ALLOCATION IS ---> number-pages ----> PAGES ---------+ |
  | +-> PAGE SIZE IS ----> page-blocks -----> BLOCKS --------+ |
  | +-> PAGE FORMAT IS --+----> UNIFORM ----+----------------+ |
  | |                    +----> MIXED ------+                | |
  | +-> THRESHOLDS ARE ( val1 -+----------------------+-> ) -+ |
  | |                          +-> ,val2 -+----------++      | |
  | |                                     +-> ,val3 -+       | |
  | +-> INTERVAL IS -------> number-data-pages --------------+ |
  | +-> EXTENT IS ----+--> extent-pages ----> PAGES ----+----+ |
  | |                 +--> (extension-options)----------+    | |
  | +-> SNAPSHOT FILENAME ---> file-spec --------------------+ |
  | +-> SNAPSHOT ALLOCATION IS --> snp-pages --> PAGES ------+ |
  | +-> SNAPSHOT EXTENT IS -+-> extent-pages --> PAGES -+----+ |
  |                         +-> (extension-options) ----+      |
  +----------------------------<-------------------------------+

 Parameters that control the characteristics of the storage area.

STORAGE_MAP

 ALTER STORAGE MAP map-name -+
 +---------------------------+
 +--+---+-> store-clause ---------------------+-+--+->;
    |   +-> NO PLACEMENT VIA INDEX -----------+ |  |
    |   +-> PLACEMENT VIA INDEX index-name ---+ |  |
    |   +-+-> ENABLE --+-> COMPRESSION -------+ |  |
    |   | +-> DISABLE -+                        |  |
    |   +-> REORGANIZE --> --+---->------+------+  |
    |                        +-> AREAS --+         |
    |                        +-> PAGES --+         |
    +----------------------<-----------------------+

Additional information available:

More Informationstore clause

More Information

 Changes an existing storage map.  A storage map controls which rows
 of a table are stored in which storage areas in a multifile database.

 In addition to changing storage maps, ALTER STORAGE MAP has options
 that change:

  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

  o  Whether the data in the existing storage areas will be
     reorganized

store clause

 store-clause = STORE -+
 +---------------------+
 +-> IN area-name -------------------------------------------------+->
 +-> ACROSS -> ( -+-> area-name -+-> ) ----------------------------+
 |                +----- , <-----+                                 |
 +-> USING -> ( -+-> column-name -+-> ) -+                         |
                 +------ , <------+      |                         |
  +--------------------------------------+                         |
  ++-> IN area-name WITH LIMIT OF -> ( -+- literal -+-> ) -+-+     |
   |                                    +---- , <---+      | |     |
   +-------------------------- <---------------------------+ |     |
  +----------------------------------------------------------+     |
  +-> OTHERWISE IN area-name --------------------------------------+

Additional information available:

More Information

More Information

 A new storage map definition that replaces the existing storage map.
 The store clause 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 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.

TABLE

 ALTER TABLE --> table-name --+
 +----------------------------+
 +-+-+-> ADD -+-> COLUMN add-col-definition ---------+--> ;
   | |        +-> CONSTRAINT table-constraint -------+
   | +-> ALTER alter-col-definition -----------------+
   | +-> DROP -+-> COLUMN column-name ---------------+
   |           +-> CONSTRAINT constraint-name -------+
   +-------------------- <---------------------------+

Additional information available:

ADD_COLUMNADD_CONSTRAINTALTER_COLUMNDROP_COLUMN
DROP_CONSTRAINT

More Information

More Information

 The ALTER TABLE statement changes an existing table definition.  You
 can:

  o  Add columns

  o  Add constraints to tables or columns

  o  Modify columns

  o  Delete columns

  o  Delete constraints

ADD_COLUMN

 The ADD COLUMN clause creates an additional column in the table.  SQL
 adds the column to the right of the existing columns in the table.

 add-col-definition =

  ->column-name --+-> data-type ---+--+-------------------+-+
                  +-> domain-name -+  +-> default value --+ |
  +---------------------------------------------------------+
  +--+------------------+-+-----------------------+->
     +-> col-constraint-+ +-> sql-and-dtr-clause -+
                          +------------<----------+

 Specify a name for the column, a data type or domain name, and
 optional default value, column-constraints, and SQL and DATATRIEVE
 formatting clauses for the column specified by the column name.

Additional information available:

COLLATING_SEQUENCE_IS

data typedefault valuecol constraintsql and dtr clause

data type

 data-type =

 --+-> CHAR -+--------+---------------------------+-->
   |         +-> (n) -+                           |
   +-> VARCHAR (n) -------------------------------+
   +-> LONG VARCHAR ------------------------------+
   +-> TINYINT --------------+-----+--------+-----+
   +-> SMALLINT -------------+     +-> (n) -+     |
   +-> INTEGER --------------+                    |
   +-> QUADWORD -------------+                    |
   +-> LIST OF BYTE VARYING -+                    |
   +-> DECIMAL -+-+-----------------------------+-+
   +-> NUMERIC -+ +-> ( --> n -+--------+-> ) --+ |
   |                           +-> , n -+         |
   +-> FLOAT -+--------+--------------------------+
   |          +-> (n) -+                          |
   +-> REAL --------------------------------------+
   +-> DOUBLE PRECISION --------------------------+
   +-> DATE --------------------------------------+

default value

 default-value =

 DEFAULT --+-->literal -+--->
           +-->USER  ---+
           +-->NULL  ---+

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.

col constraint

 col-constraint =

 -+-> PRIMARY KEY ----------------------+--+
  +-> NOT NULL -------------------------+  |
  +-> UNIQUE ---------------------------+  |
  +-> CHECK (predicate) ----------------+  |
  +-> references-clause ----------------+  |
  +-----------------------<----------------+
  +-+----------------->-------------+->
    +-> CONSTRAINT constraint-name -+

Additional information available:

More Informationreferences clause

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 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 unique key or
 primary 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 the referenced_column_name is the
 name of the column or columns that are a unique key or primary key in
 the referenced table.  The unique key can be defined with either the
 UNIQUE or PRIMARY KEY keywords.  If you omit the
 referenced_column_name, the primary key is selected by default.

sql and dtr clause

 sql-and-dtr-clause =

 -+-> QUERY HEADER IS -+> quoted-string --+-----------------+->
  |                    +------ / <--------+                 |
  +-> EDIT STRING IS quoted-string -------------------------+
  |                                                         |
  +-> QUERY NAME FOR -+-> DTR --------+-> IS quoted-string -+
  |                   +-> DATATRIEVE -+                     |
  +-> DEFAULT VALUE FOR -+-> DTR --------+-> IS literal ----+
  |                      +-> DATATRIEVE -+                  |
  +-> NO QUERY HEADER --------------------------------------+
  +-> NO EDIT STRING ---------------------------------------+
  +-> NO QUERY NAME ----+--> FOR -+-> DTR --------+---------+
  +-> NO DEFAULT VALUE -+         +-> DATATRIEVE -+

 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.

ADD_CONSTRAINT

 The ADD CONSTRAINT clause adds a table 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.

 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

ALTER_COLUMN

 The ALTER COLUMN clause modifies the column specified by the column
 name:

 alter-col-definition =

 -> column-name -+-------->-------+-+--------->--------+--+
                 +-> data-type ---+ +-> default-value -+  |
                 +-> domain-name -+                       |
   +------------------------------------------------------+
   +--++------------>------------+-+-+
      |+-> add-col-constraint ---+ | |
      +-------------<--------------+ |
   +---------------------------------+
   +--+------------>--------------------+--->
      +-+-> sql-and-dtr-clause ------+--+
        +--------------<-------------+

Additional information available:

COLLATING_SEQUENCE_IS

More Informationdata typedefault valueadd col constraintsql and dtr clause

More Information

 You can modify some elements of a column definition but not others:

  o  You cannot change the column name.

  o  You can change an explicitly specified data type to another, but
     use care (see notes in this argument description).

  o  You can add or modify the default value.

  o  You can change the domain referred to by a column, provided the
     domain exists in the schema

  o  You can substitute an explicit data type for a column that
     previously referred to a domain name

  o  If you do not want to change the data type or domain of an
     existing column, you do not need to specify a data type or domain
     name.

  o  You cannot change an existing column constraint.  However, you
     can drop the existing constraint and add a new column constraint
     using the ALTER COLUMN statement to achieve the same result.

  o  You can specify any column to be NOT NULL.  The only way you can
     alter an existing constraint to be not null is by using the ALTER
     TABLE statement.

  o  You can change a formatting clause by redefining clauses or
     overriding existing clauses with NO options.  If you add a new
     clause, existing clauses are unaffected.

data type

 data-type =

 --+-> CHAR -+--------+---------------------------+-->
   |         +-> (n) -+                           |
   +-> VARCHAR (n) -------------------------------+
   +-> LONG VARCHAR ------------------------------+
   +-> TINYINT --------------+-----+--------+-----+
   +-> SMALLINT -------------+     +-> (n) -+     |
   +-> INTEGER --------------+                    |
   +-> QUADWORD -------------+                    |
   +-> LIST OF BYTE VARYING -+                    |
   +-> DECIMAL -+-+-----------------------------+-+
   +-> NUMERIC -+ +-> ( --> n -+--------+-> ) --+ |
   |                           +-> , n -+         |
   +-> FLOAT -+--------+--------------------------+
   |          +-> (n) -+                          |
   +-> REAL --------------------------------------+
   +-> DOUBLE PRECISION --------------------------+
   +-> DATE --------------------------------------+

default value

 default-value =

 DEFAULT --+-->literal -+--->
           +-->USER  ---+
           +-->NULL  ---+

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.

add col constraint

 col-constraint =

 -+-> PRIMARY KEY ----------------------+--+
  +-> NOT NULL -------------------------+  |
  +-> UNIQUE ---------------------------+  |
  +-> CHECK (predicate) ----------------+  |
  +-> references-clause ----------------+  |
  +-----------------------<----------------+
  +-+----------------->-------------+->
    +-> CONSTRAINT constraint-name -+

Additional information available:

More Informationreferences clause

More Information
 The add-col-constraint clause specifies a constraint definition that
 applies to an existing column.  The syntax and explanation for the
 add-col-constraint clause are the same as for the col-constraint
 clause.

 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.

 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.  The unique key can be defined with either the
 UNIQUE or PRIMARY KEY keywords.  If you omit the
 referenced_column_name, the primary key in the referenced table is
 used.

sql and dtr clause

 sql-and-dtr-clause =

 -+-> QUERY HEADER IS -+> quoted-string --+-----------------+->
  |                    +------ / <--------+                 |
  +-> EDIT STRING IS quoted-string -------------------------+
  |                                                         |
  +-> QUERY NAME FOR -+-> DTR --------+-> IS quoted-string -+
  |                   +-> DATATRIEVE -+                     |
  +-> DEFAULT VALUE FOR -+-> DTR --------+-> IS literal ----+
  |                      +-> DATATRIEVE -+                  |
  +-> NO QUERY HEADER --------------------------------------+
  +-> NO EDIT STRING ---------------------------------------+
  +-> NO QUERY NAME ----+--> FOR -+-> DTR --------+---------+
  +-> NO DEFAULT VALUE -+         +-> DATATRIEVE -+

 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

 Specifies a new collating sequence for the named domain.

DROP_COLUMN

 The DROP COLUMN statement deletes the specified column.

DROP_CONSTRAINT

 The DROP CONSTRAINT statement deletes the specified column constraint
 or table constraint from the table definition.

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