Creation of base tables

You use the CREATE TABLE statement to create a base table that you have designed.

When you create a table, Db2 records a definition of the table in the Db2 catalog. Creating a table does not store the application data. You can put data into the table by using several methods, such as the LOAD utility or the INSERT statement.

Begin general-use programming interface information.

Example

The following CREATE TABLE statement creates the EMP table, which is in a database named MYDB and in a table space named MYTS:

CREATE TABLE EMP
      (EMPNO     CHAR(6)         NOT NULL,
       FIRSTNME  VARCHAR(12)     NOT NULL,
       LASTNAME  VARCHAR(15)     NOT NULL,
       DEPT      CHAR(3)                 ,
       HIREDATE  DATE                    ,
       JOB       CHAR(8)                 ,
       EDL       SMALLINT                ,
       SALARY    DECIMAL(9,2)            ,
       COMM      DECIMAL(9,2)            ,
       PRIMARY KEY (EMPNO))
IN MYDB.MYTS;  

The preceding CREATE TABLE statement shows the definition of multiple columns.

End general-use programming interface information.