Previous Topic: Deleting Source and Output MembersNext Topic: Creating a Schema


Creating SQL Objects

This chapter contains the following topics:

In Interactive SQL Service Facility, you can use the SQL Data Definition Language to define the components of a relational database, alter a table definition and add or replace comments.

CREATE SCHEMA

Defines the authorization ID (which is the name of the schema) and can also include table, view and privilege definitions.

CREATE DATABASE

Defines a Database. You must name the database name and the database Identifier (5-digit number 0-5000). You can optionally specify several other attributes for the database.

CREATE AREA

Defines an area. You must specify the SQL area name, block size, and the 3-char CA Datacom short name for the area, as well as the database that will contain this area.

CREATE TABLE

Defines a base table and its columns. You must name the table and each column, and also specify the data type and length of each column. You can optionally specify if one or more columns are to have a unique value for each row in the table or other constraints, and the area where the table's data is stored.

ALTER TABLE

Changes the definition of a base table, its columns and constraints.

CREATE INDEX

Defines an index on one or more columns of a base table to improve performance of queries which reference that table.

CREATE VIEW

Defines a view, or derived table, which can be based on one or more base tables, or even on other views. You can also specify search conditions which limit the rows appearing in the view.

CREATE SYNONYM

Defines an alternative name for a table or a view. Synonyms are especially useful when referencing a table or view owned by another authorization ID since the definition includes the qualified name of the object.

COMMENT ON

Adds or replaces text to the TABLE, COLUMN or VIEW occurrence in CA Datacom Datadictionary.

For information about the CA Datacom/DB implementation of support for CREATE PROCEDURE and CREATE TRIGGER/RULE statements, see Procedures and Triggers and Datadictionary Support for Triggers and Procedures.