A table is a logical structure of a data in a DB2. A table consists of a column which represents the attribute and rows represents the entity. Below command can be issued in order to create a new DB2 table.
CREATE TABLE DBSET1.TAB1 (STUDENT_ID CHAR(10) NOT NULL, ENROLLMENT_ID CHAR(20) NOT NULL, NAME VARCHAR(50), AGE SMALLINT PRIMARY KEY (STUDENT_ID));
The CREATE TABLE reserved words are followed by the name of the table which we have to create in the format <DATABASENAME.TABLENAME>. Here DBSET1 is the database and TAB1 is the table.
The name of the column has to be mentioned followed by data type for each of the columns like CHAR for character data, VARCHAR for variable character (used for indeterminate length) and SMALLINT for small integer value which occupies 2 bytes.
The PRIMARY KEY parameter defines the primary key of the table which has to be unique throughout the rows present in the table.