Creating base tables

When you create a table, DB2® records a definition of the table in the DB2 catalog.

About this task

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.

Procedure

To create a base table that you designed:

Issue the CREATE TABLE statement.

Example

Begin general-use programming interface information.
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;  

This CREATE TABLE statement shows the definition of multiple columns.

End general-use programming interface information.