> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kinetica.com/llms.txt
> Use this file to discover all available pages before exploring further.

# createTable

<div className="kinetica-javadoc">
  <ul className="member-list">
    <li>
      <div className="section detail" id="createTable(com.gpudb.protocol.CreateTableRequest)">
        <h3>createTable</h3>
        <div className="member-signature"><span className="modifiers">public</span> <span className="return-type"><a href="/content/api/java/com/gpudb/protocol/CreateTableResponse" title="class in com.gpudb.protocol">CreateTableResponse</a></span> <span className="element-name">createTable</span><wbr /><span className="parameters">(<a href="/content/api/java/com/gpudb/protocol/CreateTableRequest" title="class in com.gpudb.protocol">CreateTableRequest</a> request)</span> throws <span className="exceptions"><a href="/content/api/java/com/gpudb/GPUdbException" title="class in com.gpudb">GPUdbException</a></span></div>

        <div className="block">
          Creates a new table with the given type (definition of columns). The type is specified in <a href="/content/api/java/com/gpudb/protocol/CreateTableRequest#getTypeId()"><code>typeId</code></a> as either a numerical type ID (as returned by <a href="#createType(com.gpudb.protocol.CreateTypeRequest)"><code>createType</code></a>) or as a list of columns, each specified as a list of the column name, data type, and any column attributes.
          <p> Example of a type definition with some parameters: </p>

          <div>
            ```
                 [
                     ["id", "int8", "primary_key"],
                     ["dept_id", "int8", "primary_key", "shard_key"],
                     ["manager_id", "int8", "nullable"],
                     ["first_name", "char32"],
                     ["last_name", "char64"],
                     ["salary", "decimal"],
                     ["hire_date", "date"]
                 ]
             
            ```
          </div>

          Each column definition consists of the column name (which should meet the standard <a href="/content/concepts/tables/#table-naming-criteria" target="_top">column naming criteria</a>), the column's <a href="/content/concepts/types/#types-chart" target="_top">specific type</a> (int, long, float, double, string, bytes, or any of the properties map values from <a href="#createType(com.gpudb.protocol.CreateTypeRequest)"><code>createType</code></a>), and any <a href="/content/concepts/types/#types-data-handling" target="_top">data handling</a>, <a href="/content/concepts/types/#types-data-keys" target="_top">data key</a>, or <a href="/content/concepts/types/#types-data-replace" target="_top">data replacement</a> properties.
          <p> A table may optionally be designated to use a <a href="/content/concepts/tables/#replication" target="_top">replicated</a> distribution scheme, or be assigned: <a href="/content/concepts/tables/#foreign-keys" target="_top">foreign keys</a> to other tables, a <a href="/content/concepts/tables/#partitioning" target="_top">partitioning</a> scheme, and/or a <a href="/content/rm/concepts/#tier-strategies" target="_top">tier strategy</a>.</p>
        </div>

        <div className="dl notes">
          <div className="dt">Parameters:</div>
          <div className="dd"><code>request</code> - <a href="/content/api/java/com/gpudb/protocol/CreateTableRequest" title="class in com.gpudb.protocol"><code>Request</code></a> object containing the parameters for the operation.</div>
          <div className="dt">Returns:</div>
          <div className="dd"><a href="/content/api/java/com/gpudb/protocol/CreateTableResponse" title="class in com.gpudb.protocol"><code>Response</code></a> object containing the results of the operation.</div>
          <div className="dt">Throws:</div>
          <div className="dd"><code><a href="/content/api/java/com/gpudb/GPUdbException" title="class in com.gpudb">GPUdbException</a></code> - if an error occurs during the operation.</div>
        </div>
      </div>
    </li>

    <li>
      <div className="section detail" id="createTable(java.lang.String,java.lang.String,java.util.Map)">
        <h3>createTable</h3>
        <div className="member-signature"><span className="modifiers">public</span> <span className="return-type"><a href="/content/api/java/com/gpudb/protocol/CreateTableResponse" title="class in com.gpudb.protocol">CreateTableResponse</a></span> <span className="element-name">createTable</span><wbr /><span className="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" className="external-link">String</a> tableName, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" className="external-link">String</a> typeId, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Map.html" title="class or interface in java.util" className="external-link">Map</a>\<<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" className="external-link">String</a>,<wbr /><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" className="external-link">String</a>> options)</span> throws <span className="exceptions"><a href="/content/api/java/com/gpudb/GPUdbException" title="class in com.gpudb">GPUdbException</a></span></div>

        <div className="block">
          Creates a new table with the given type (definition of columns). The type is specified in <code>typeId</code> as either a numerical type ID (as returned by <a href="#createType(java.lang.String,java.lang.String,java.util.Map,java.util.Map)"><code>createType</code></a>) or as a list of columns, each specified as a list of the column name, data type, and any column attributes.
          <p> Example of a type definition with some parameters: </p>

          <div>
            ```
                 [
                     ["id", "int8", "primary_key"],
                     ["dept_id", "int8", "primary_key", "shard_key"],
                     ["manager_id", "int8", "nullable"],
                     ["first_name", "char32"],
                     ["last_name", "char64"],
                     ["salary", "decimal"],
                     ["hire_date", "date"]
                 ]
             
            ```
          </div>

          Each column definition consists of the column name (which should meet the standard <a href="/content/concepts/tables/#table-naming-criteria" target="_top">column naming criteria</a>), the column's <a href="/content/concepts/types/#types-chart" target="_top">specific type</a> (int, long, float, double, string, bytes, or any of the properties map values from <a href="#createType(java.lang.String,java.lang.String,java.util.Map,java.util.Map)"><code>createType</code></a>), and any <a href="/content/concepts/types/#types-data-handling" target="_top">data handling</a>, <a href="/content/concepts/types/#types-data-keys" target="_top">data key</a>, or <a href="/content/concepts/types/#types-data-replace" target="_top">data replacement</a> properties.
          <p> A table may optionally be designated to use a <a href="/content/concepts/tables/#replication" target="_top">replicated</a> distribution scheme, or be assigned: <a href="/content/concepts/tables/#foreign-keys" target="_top">foreign keys</a> to other tables, a <a href="/content/concepts/tables/#partitioning" target="_top">partitioning</a> scheme, and/or a <a href="/content/rm/concepts/#tier-strategies" target="_top">tier strategy</a>.</p>
        </div>

        <div className="dl notes">
          <div className="dt">Parameters:</div>
          <div className="dd"><code>tableName</code> - Name of the table to be created, in \[schema\_name.]table\_name format, using standard <a href="/content/concepts/tables/#table-name-resolution" target="_top">name resolution rules</a> and meeting <a href="/content/concepts/tables/#table-naming-criteria" target="_top">table naming criteria</a>. Error for requests with existing table of the same name and type ID may be suppressed by using the <a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#NO_ERROR_IF_EXISTS"><code>NO\_ERROR\_IF\_EXISTS</code></a> option.</div>
          <div className="dd"><code>typeId</code> - The type for the table, specified as either an existing table's numerical type ID (as returned by <a href="#createType(java.lang.String,java.lang.String,java.util.Map,java.util.Map)"><code>createType</code></a>) or a type definition (as described above).</div>

          <div className="dd">
            <code>options</code> - Optional parameters.

            <ul>
              <li>
                <a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#NO_ERROR_IF_EXISTS"><code>NO\_ERROR\_IF\_EXISTS</code></a>: If <a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#TRUE"><code>TRUE</code></a>, prevents an error from occurring if the table already exists and is of the given type. If a table with the same ID but a different type exists, it is still an error. Supported values:

                <ul>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#TRUE"><code>TRUE</code></a> </li>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#FALSE"><code>FALSE</code></a> </li>
                </ul>

                The default value is <a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#FALSE"><code>FALSE</code></a>.
              </li>

              <li>
                <a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#CREATE_TEMP_TABLE"><code>CREATE\_TEMP\_TABLE</code></a>: If <a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#TRUE"><code>TRUE</code></a>, a unique temporary table name will be generated in the sys\_temp schema and used in place of <code>tableName</code>. If <a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#IS_RESULT_TABLE"><code>IS\_RESULT\_TABLE</code></a> is <a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#TRUE"><code>TRUE</code></a>, then this is always allowed even if the caller does not have permission to create tables. The generated name is returned in <a href="/content/api/java/com/gpudb/protocol/CreateTableResponse.Info#QUALIFIED_TABLE_NAME"><code>QUALIFIED\_TABLE\_NAME</code></a>. Supported values:

                <ul>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#TRUE"><code>TRUE</code></a> </li>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#FALSE"><code>FALSE</code></a> </li>
                </ul>

                The default value is <a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#FALSE"><code>FALSE</code></a>.
              </li>

              <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#COLLECTION_NAME"><code>COLLECTION\_NAME</code></a>: \[DEPRECATED--please specify the containing schema as part of <code> tableName</code> and use <a href="#createSchema(java.lang.String,java.util.Map)"><code>createSchema</code></a> to create the schema if non-existent] Name of a schema which is to contain the newly created table. If the schema is non-existent, it will be automatically created. </li>

              <li>
                <a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#IS_COLLECTION"><code>IS\_COLLECTION</code></a>: \[DEPRECATED--please use <a href="#createSchema(java.lang.String,java.util.Map)"><code>createSchema</code></a> to create a schema instead] Indicates whether to create a schema instead of a table. Supported values:

                <ul>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#TRUE"><code>TRUE</code></a> </li>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#FALSE"><code>FALSE</code></a> </li>
                </ul>

                The default value is <a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#FALSE"><code>FALSE</code></a>.
              </li>

              <li>
                <a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#IS_REPLICATED"><code>IS\_REPLICATED</code></a>: Affects the <a href="/content/concepts/tables/#distribution" target="_top">distribution scheme</a> for the table's data. If <a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#TRUE"><code>TRUE</code></a> and the given type has no explicit <a href="/content/concepts/tables/#shard-key" target="_top">shard key</a> defined, the table will be <a href="/content/concepts/tables/#replication" target="_top">replicated</a>. If <a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#FALSE"><code>FALSE</code></a>, the table will be <a href="/content/concepts/tables/#sharding" target="_top">sharded</a> according to the shard key specified in the given <code>typeId</code>, or <a href="/content/concepts/tables/#random-sharding" target="_top">randomly sharded</a>, if no shard key is specified. Note that a type containing a shard key cannot be used to create a replicated table. Supported values:

                <ul>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#TRUE"><code>TRUE</code></a> </li>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#FALSE"><code>FALSE</code></a> </li>
                </ul>

                The default value is <a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#FALSE"><code>FALSE</code></a>.
              </li>

              <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#FOREIGN_KEYS"><code>FOREIGN\_KEYS</code></a>: Semicolon-separated list of <a href="/content/concepts/tables/#foreign-keys" target="_top">foreign keys</a>, of the format '(source\_column\_name \[, ...]) references target\_table\_name(primary\_key\_column\_name \[, ...]) \[as foreign\_key\_name]'. </li>
              <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#FOREIGN_SHARD_KEY"><code>FOREIGN\_SHARD\_KEY</code></a>: Foreign shard key of the format 'source\_column references shard\_by\_column from target\_table(primary\_key\_column)'. </li>

              <li>
                <a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#PARTITION_TYPE"><code>PARTITION\_TYPE</code></a>: <a href="/content/concepts/tables/#partitioning" target="_top">Partitioning</a> scheme to use. Supported values:

                <ul>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#RANGE"><code>RANGE</code></a>: Use <a href="/content/concepts/tables/#partitioning-by-range" target="_top">range partitioning</a>. </li>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#INTERVAL"><code>INTERVAL</code></a>: Use <a href="/content/concepts/tables/#partitioning-by-interval" target="_top">interval partitioning</a>. </li>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#LIST"><code>LIST</code></a>: Use <a href="/content/concepts/tables/#partitioning-by-list" target="_top">list partitioning</a>. </li>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#HASH"><code>HASH</code></a>: Use <a href="/content/concepts/tables/#partitioning-by-hash" target="_top">hash partitioning</a>. </li>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#SERIES"><code>SERIES</code></a>: Use <a href="/content/concepts/tables/#partitioning-by-series" target="_top">series partitioning</a>. </li>
                </ul>
              </li>

              <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#PARTITION_KEYS"><code>PARTITION\_KEYS</code></a>: Comma-separated list of partition keys, which are the columns or column expressions by which records will be assigned to partitions defined by <a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#PARTITION_DEFINITIONS"><code>PARTITION\_DEFINITIONS</code></a>. </li>
              <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#PARTITION_DEFINITIONS"><code>PARTITION\_DEFINITIONS</code></a>: Comma-separated list of partition definitions, whose format depends on the choice of <a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#PARTITION_TYPE"><code>PARTITION\_TYPE</code></a>. See <a href="/content/concepts/tables/#partitioning-by-range" target="_top">range partitioning</a>, <a href="/content/concepts/tables/#partitioning-by-interval" target="_top">interval partitioning</a>, <a href="/content/concepts/tables/#partitioning-by-list" target="_top">list partitioning</a>, <a href="/content/concepts/tables/#partitioning-by-hash" target="_top">hash partitioning</a>, or <a href="/content/concepts/tables/#partitioning-by-series" target="_top">series partitioning</a> for example formats. </li>

              <li>
                <a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#IS_AUTOMATIC_PARTITION"><code>IS\_AUTOMATIC\_PARTITION</code></a>: If <a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#TRUE"><code>TRUE</code></a>, a new partition will be created for values which don't fall into an existing partition. Currently only supported for <a href="/content/concepts/tables/#partitioning-by-list" target="_top">list partitions</a>. Supported values:

                <ul>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#TRUE"><code>TRUE</code></a> </li>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#FALSE"><code>FALSE</code></a> </li>
                </ul>

                The default value is <a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#FALSE"><code>FALSE</code></a>.
              </li>

              <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#TTL"><code>TTL</code></a>: Sets the <a href="/content/concepts/ttl/" target="_top">TTL</a> of the table specified in <code>tableName</code>. </li>
              <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#CHUNK_SIZE"><code>CHUNK\_SIZE</code></a>: Indicates the number of records per chunk to be used for this table. </li>
              <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#CHUNK_COLUMN_MAX_MEMORY"><code>CHUNK\_COLUMN\_MAX\_MEMORY</code></a>: Indicates the target maximum data size for each column in a chunk to be used for this table. </li>
              <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#CHUNK_MAX_MEMORY"><code>CHUNK\_MAX\_MEMORY</code></a>: Indicates the target maximum data size for all columns in a chunk to be used for this table. </li>

              <li>
                <a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#IS_RESULT_TABLE"><code>IS\_RESULT\_TABLE</code></a>: Indicates whether the table is a <a href="/content/concepts/tables_memory_only/" target="_top">memory-only table</a>. A result table cannot contain columns with text\_search <a href="/content/concepts/types/#data-handling" target="_top">data-handling</a>, and it will not be retained if the server is restarted. Supported values:

                <ul>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#TRUE"><code>TRUE</code></a> </li>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#FALSE"><code>FALSE</code></a> </li>
                </ul>

                The default value is <a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#FALSE"><code>FALSE</code></a>.
              </li>

              <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#STRATEGY_DEFINITION"><code>STRATEGY\_DEFINITION</code></a>: The <a href="/content/rm/concepts/#tier-strategies" target="_top">tier strategy</a> for the table and its columns. </li>
              <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#COMPRESSION_CODEC"><code>COMPRESSION\_CODEC</code></a>: The default <a href="/content/concepts/column_compression/" target="_top">compression codec</a> for this table's columns. </li>

              <li>
                <a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#LOAD_VECTORS_POLICY"><code>LOAD\_VECTORS\_POLICY</code></a>: Set startup data loading scheme for the table. Supported values:

                <ul>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#ALWAYS"><code>ALWAYS</code></a>: Load as much vector data as possible into memory before accepting requests. </li>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#LAZY"><code>LAZY</code></a>: Load the necessary vector data at start, and load the remainder lazily. </li>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#ON_DEMAND"><code>ON\_DEMAND</code></a>: Load vector data as requests use it. </li>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#SYSTEM"><code>SYSTEM</code></a>: Load vector data using the system-configured default. </li>
                </ul>

                The default value is <a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#SYSTEM"><code>SYSTEM</code></a>.
              </li>

              <li>
                <a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#BUILD_PK_INDEX_POLICY"><code>BUILD\_PK\_INDEX\_POLICY</code></a>: Set startup primary-key index generation scheme for the table. Supported values:

                <ul>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#ALWAYS"><code>ALWAYS</code></a>: Generate as much primary key index data as possible before accepting requests. </li>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#LAZY"><code>LAZY</code></a>: Generate the necessary primary key index data at start, and load the remainder lazily. </li>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#ON_DEMAND"><code>ON\_DEMAND</code></a>: Generate primary key index data as requests use it. </li>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#SYSTEM"><code>SYSTEM</code></a>: Generate primary key index data using the system-configured default. </li>
                </ul>

                The default value is <a href="/content/api/java/com/gpudb/protocol/CreateTableRequest.Options#SYSTEM"><code>SYSTEM</code></a>.
              </li>
            </ul>

            The default value is an empty <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Map.html" title="class or interface in java.util" className="external-link"><code>Map</code></a>.
          </div>

          <div className="dt">Returns:</div>
          <div className="dd"><a href="/content/api/java/com/gpudb/protocol/CreateTableResponse" title="class in com.gpudb.protocol"><code>Response</code></a> object containing the results of the operation.</div>
          <div className="dt">Throws:</div>
          <div className="dd"><code><a href="/content/api/java/com/gpudb/GPUdbException" title="class in com.gpudb">GPUdbException</a></code> - if an error occurs during the operation.</div>
        </div>
      </div>
    </li>
  </ul>
</div>
