The following example shows a CREATE TABLE statement. See How to Submit SQL Statements for the steps to obtain the Source Panel and an explanation of the fields.
=> => => ------------------------------------------------------------------------------- Interactive SQL Service Facility SQLMAINT Source Panel S01S EDIT Member: $DDSQL Output Line Limit: 01000 Person: JONES Current Authid: JONES Description: CREATE TABLE DEPTTBL ------------------------------------------------------------------------------- ====== ========================== T O P ======================================= 000001 create table depttbl ...... (deptno char(2) not null, ...... deptname char(24) not null, ...... mgrnbr char(6) not null, ...... unique (deptno, mgrnbr)); ====== ======================= B O T T O M ==================================== PF1=HELP PF2=END PF3=SPLIT PF4=PROCESS PF5=TOP PF6=BOTTOM PF7=BACKWARD PF8=FORWARD PF9=EXECUTE PF10=LEFT PF11=RIGHT PF12=ALTERNATE
Before entering the statement, we inserted four additional lines on the panel by typing i4 in the line number and pressing Enter.
The statement CREATE TABLE is required and must be followed by the name of the table, which is DEPTTBL in this example. Since the name of a data area in which the table is to reside is not specified, it is placed in the default area.
Each column definition is listed on a separate line and indented from the left simply for ease of reading. In this example, all the columns are of the CHARACTER data type. The short form, CHAR, is used, followed by the length in parentheses. NOT NULL is specified for the first three columns so that these columns cannot contain null values. The list of column names must be enclosed in parentheses. You must separate the column definitions from each other with a comma.
The table-level UNIQUE constraint specifies that the combined values of the DEPTNO and MGRNBR columns are to be unique for each row of this table. The columns specified in a table-level UNIQUE constraint must be defined with NOT NULL. The column names must be separated by commas and the list enclosed in parentheses when using this form of the UNIQUE constraint.
For information on the syntax of the CREATE TABLE statement, see CREATE TABLE.
After placing your SQL statement in the numbered line area on the Source Panel, you can perform the following:
|
Copyright © 2014 CA.
All rights reserved.
|
|