Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The following steps are required to create a table in DB2 using AS and indicating the tablespace:

  1. Log in to DB2 using a valid user ID and password.
  2. Open a new command window or terminal session.
  3. Type the following command to create a new table:

CREATE TABLE newtablename AS (SELECT * FROM existingtablename)

  1. After the AS keyword, specify the tablespace where the new table will be stored. For example:

CREATE TABLE newtablename AS (SELECT * FROM existingtablename) TABLESPACE newtablespacename

  1. Press Enter to execute the command.
  2. Verify that the new table has been created by running a SELECT statement on the newtablename.