org.h2.command.ddl

## Class CreateTable

- java.lang.Object
- - org.h2.command.Prepared
  - - org.h2.command.ddl.DefineCommand
    - - org.h2.command.ddl.SchemaCommand
      - - org.h2.command.ddl.CommandWithColumns
        - - org.h2.command.ddl.CreateTable

    public class CreateTable
    extends CommandWithColumns

This class represents the statement CREATE TABLE

### Field Summary

### Fields inherited from class org.h2.command.ddl.DefineCommand

`transactional`

### Fields inherited from class org.h2.command.Prepared

`create, parameters, prepareAlways, session, sqlStatement`

### Constructor Summary

Constructors
Constructor and Description
`CreateTable(Session session, Schema schema)`

### Method Summary

Methods
`void` `addColumn(Column column)` Add a column to this table.
`int` `getType()` Get the command type as defined in CommandInterface
`void` `setComment(java.lang.String comment)`
`void` `setGlobalTemporary(boolean globalTemporary)`
`void` `setHidden(boolean isHidden)`
`void` `setIfNotExists(boolean ifNotExists)`
`void` `setOnCommitDrop()` This temporary table is dropped on commit.
`void` `setOnCommitTruncate()` This temporary table is truncated on commit.
`void` `setPersistData(boolean persistData)`
`void` `setPersistIndexes(boolean persistIndexes)`
`void` `setQuery(Query query)`
`void` `setSortedInsertMode(boolean sortedInsertMode)`
`void` `setTableEngine(java.lang.String tableEngine)`
`void` `setTableEngineParams(java.util.ArrayList<java.lang.String> tableEngineParams)`
`void` `setTableName(java.lang.String tableName)`
`void` `setTemporary(boolean temporary)`
`void` `setWithNoData(boolean withNoData)`
`int` `update()` Execute the statement.

### Methods inherited from class org.h2.command.ddl.CommandWithColumns

`addConstraintCommand, changePrimaryKeysToNotNull, createConstraints, generateSequences`

### Methods inherited from class org.h2.command.ddl.SchemaCommand

`getSchema`

### Methods inherited from class org.h2.command.ddl.DefineCommand

`isReadOnly, isTransactional, queryMeta, setTransactional`

### Methods inherited from class org.h2.command.Prepared

`checkCanceled, checkParameters, getCteCleanups, getCurrentRowNumber, getObjectId, getParameters, getPersistedObjectId, getPlanSQL, getSession, getSimpleSQL, getSQL, getSQL, isCacheable, isQuery, needRecompile, prepare, query, setCommand, setCteCleanups, setCurrentRowNumber, setParameterList, setPersistedObjectId, setPrepareAlways, setRow, setSession, setSQL, toString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### CreateTable

    public CreateTable(Session session,
               Schema schema)

### Method Detail

#### setQuery

    public void setQuery(Query query)

#### setTemporary

    public void setTemporary(boolean temporary)

#### setTableName

    public void setTableName(java.lang.String tableName)

#### addColumn

    public void addColumn(Column column)

Description copied from class: `CommandWithColumns`
Add a column to this table.

Specified by:
  `addColumn` in class `CommandWithColumns`
Parameters:
  `column` - the column to add

#### setIfNotExists

    public void setIfNotExists(boolean ifNotExists)

#### update

    public int update()

Description copied from class: `Prepared`
Execute the statement.

Overrides:
  `update` in class `Prepared`
Returns:
  the update count

#### setPersistIndexes

    public void setPersistIndexes(boolean persistIndexes)

#### setGlobalTemporary

    public void setGlobalTemporary(boolean globalTemporary)

#### setOnCommitDrop

    public void setOnCommitDrop()

This temporary table is dropped on commit.

#### setOnCommitTruncate

    public void setOnCommitTruncate()

This temporary table is truncated on commit.

#### setComment

    public void setComment(java.lang.String comment)

#### setPersistData

    public void setPersistData(boolean persistData)

#### setSortedInsertMode

    public void setSortedInsertMode(boolean sortedInsertMode)

#### setWithNoData

    public void setWithNoData(boolean withNoData)

#### setTableEngine

    public void setTableEngine(java.lang.String tableEngine)

#### setTableEngineParams

    public void setTableEngineParams(java.util.ArrayList<java.lang.String> tableEngineParams)

#### setHidden

    public void setHidden(boolean isHidden)

#### getType

    public int getType()

Description copied from class: `Prepared`
Get the command type as defined in CommandInterface

Specified by:
  `getType` in class `Prepared`
Returns:
  the statement type