org.h2.table

## Class DerivedTable

- java.lang.Object
- - org.h2.engine.DbObject
  - - org.h2.schema.SchemaObject
    - - org.h2.table.Table
      - - org.h2.table.QueryExpressionTable
        - - org.h2.table.DerivedTable

All Implemented Interfaces:
  HasSQL

    public final class DerivedTable
    extends QueryExpressionTable

A derived table.

### Field Summary

### Fields inherited from class org.h2.table.Table

`columns, compareMode, EXCLUSIVE_LOCK, isHidden, READ_LOCK, TYPE_CACHED, TYPE_MEMORY, WRITE_LOCK`

### Fields inherited from class org.h2.engine.DbObject

`AGGREGATE, comment, COMMENT, CONSTANT, CONSTRAINT, database, DOMAIN, FUNCTION_ALIAS, INDEX, RIGHT, ROLE, SCHEMA, SEQUENCE, SETTING, SYNONYM, TABLE_OR_VIEW, trace, TRIGGER, USER`

### Fields inherited from interface org.h2.util.HasSQL

`ADD_PLAN_INFORMATION, DEFAULT_SQL_FLAGS, NO_CASTS, QUOTE_ONLY_WHEN_REQUIRED, REPLACE_LOBS_FOR_TRACE, TRACE_SQL_FLAGS`

### Constructor Summary

Constructors
Constructor and Description
`DerivedTable(SessionLocal session, java.lang.String name, Column[] columnTemplates, Query query, Query topQuery)` Create a derived table out of the given query.

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `canDrop()` Check if this table can be dropped.
`java.lang.String` `getCreateSQL()` Construct the CREATE ...
`java.lang.StringBuilder` `getSQL(java.lang.StringBuilder builder, int sqlFlags)` Appends the SQL statement of this object to the specified builder.
`TableType` `getTableType()` Get the table type name
`Query` `getTopQuery()`
`boolean` `isQueryComparable()` Check whether the table (or view) contains no columns that prevent index conditions to be used.

### Methods inherited from class org.h2.table.QueryExpressionTable

`addDependencies, addIndex, addRow, canGetRowCount, canReference, checkSupportAlter, close, createQueryColumnTemplateList, getBestPlanItem, getIndexes, getMaxDataModificationId, getParameterOffset, getQuery, getRowCount, getRowCountApproximation, getScanIndex, getScanIndex, isDeterministic, isInsertable, isView, removeRow, truncate`

### Methods inherited from class org.h2.table.Table

`addConstraint, addDependentMaterializedView, addDependentView, addSequence, addSynonym, addTrigger, canTruncate, checkDeadlock, checkWritingAllowed, compareValues, convertInsertRow, convertUpdateRow, createRow, doesColumnExist, dropMultipleColumnsConstraintsAndIndexes, findColumn, findPrimaryKey, fire, fireAfterRow, fireBeforeRow, fireRow, getCheckForeignKeyConstraints, getChildren, getColumn, getColumn, getColumn, getColumns, getCompareMode, getConstraints, getDependentMaterializedViews, getDependentViews, getDiskSpaceUsed, getIdentityColumn, getIndex, getIndexForColumn, getMainIndexColumn, getNullRow, getOnCommitDrop, getOnCommitTruncate, getPrimaryKey, getRow, getRowFactory, getRowIdColumn, getSQLTableType, getTemplateRow, getTemplateSimpleRow, getTriggers, getType, hasSelectTrigger, isGlobalTemporary, isHidden, isLockedExclusively, isLockedExclusivelyBy, isPersistData, isPersistIndexes, isRowLockable, isTableExpression, lock, lockRow, removeChildrenAndResources, removeColumnExpressionsDependencies, removeConstraint, removeDependentMaterializedView, removeDependentView, removeIndex, removeIndexOrTransferOwnership, removeSequence, removeSynonym, removeTrigger, rename, renameColumn, setCheckForeignKeyConstraints, setColumns, setHidden, setOnCommitDrop, setOnCommitTruncate, setTableExpression, unlock, updateRow, updateRows`

### Methods inherited from class org.h2.schema.SchemaObject

`getSchema, getSQL`

### Methods inherited from class org.h2.engine.DbObject

`checkRename, getComment, getCreateSQLForCopy, getCreateSQLForMeta, getDatabase, getDropSQL, getId, getModificationId, getName, invalidate, isTemporary, isValid, setComment, setModified, setObjectName, setTemporary, toString`

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

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

### Methods inherited from interface org.h2.util.HasSQL

`getTraceSQL`

### Constructor Detail

#### DerivedTable

    public DerivedTable(SessionLocal session,
                        java.lang.String name,
                        Column[] columnTemplates,
                        Query query,
                        Query topQuery)

Create a derived table out of the given query.

Parameters:
  `session` - the session
  `name` - the view name
  `columnTemplates` - column templates, or `null`
  `query` - the initialized query
  `topQuery` - the top level query

### Method Detail

#### isQueryComparable

    public boolean isQueryComparable()

Description copied from class: `Table`
Check whether the table (or view) contains no columns that prevent index conditions to be used. For example, a view that contains the ROWNUM() pseudo-column prevents this.

Overrides:
  `isQueryComparable` in class `QueryExpressionTable`
Returns:
  true if the table contains no query-comparable column

#### canDrop

    public boolean canDrop()

Description copied from class: `Table`
Check if this table can be dropped.

Specified by:
  `canDrop` in class `Table`
Returns:
  true if it can

#### getTableType

    public TableType getTableType()

Description copied from class: `Table`
Get the table type name

Specified by:
  `getTableType` in class `Table`
Returns:
  the table type name

#### getTopQuery

    public Query getTopQuery()

Specified by:
  `getTopQuery` in class `QueryExpressionTable`

#### getCreateSQL

    public java.lang.String getCreateSQL()

Description copied from class: `DbObject`
Construct the CREATE ... SQL statement for this object.

Specified by:
  `getCreateSQL` in class `DbObject`
Returns:
  the SQL statement

#### getSQL

    public java.lang.StringBuilder getSQL(java.lang.StringBuilder builder,
                                          int sqlFlags)

Description copied from interface: `HasSQL`
Appends the SQL statement of this object to the specified builder.

Specified by:
  `getSQL` in interface `HasSQL`
Overrides:
  `getSQL` in class `SchemaObject`
Parameters:
  `builder` - string builder
  `sqlFlags` - formatting flags
Returns:
  the specified string builder