> ## 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.

# create_table

### create\_table

<ul>
  <li>
    create\_table(\
    &#x20;table\_name: string,\
    &#x20;type\_id: string,\
    &#x20;options?: Record\<string, string>,\
    &#x20;callback?: [GPUdbCallback](https://docs.kinetica.com/content/api/javascript/types/GPUdbCallback.md),\
    ): Promise\<[CreateTableResponse](https://docs.kinetica.com/content/api/javascript/interfaces/CreateTableResponse.md)>

    Creates a new table with the given type (definition of columns). The type is specified in `type_id` as either a numerical type ID (as returned by `create_type`) or as a list of columns, each specified as a list of the column name, data type, and any column attributes.Example of a type definition with some parameters::

    ```
    [
        ["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"]
    ]
    ```

    Each column definition consists of the column name (which should meet the standard column naming criteria), the column's specific type (int, long, float, double, string, bytes, or any of the properties map values from `create_type`), and any data handling, data key, or data replacement properties.A table may optionally be designated to use a replicated distribution scheme, or be assigned: foreign keys to other tables, a partitioning scheme, and/or a tier strategy.

    #### Parameters

    <ul>
      <li>
        table\_name: string

        Name of the table to be created, in \[schema\_name.]table\_name format, using standard name resolution rules and meeting table naming criteria. Error for requests with existing table of the same name and type ID may be suppressed by using the no\_error\_if\_exists option.
      </li>

      <li>
        type\_id: string

        The type for the table, specified as either an existing table's numerical type ID (as returned by `create_type`) or a type definition (as described above).
      </li>

      <li>
        `Optional`options: Record\<string, string>

        Optional parameters.
      </li>

      <li>
        `Optional`callback: [GPUdbCallback](https://docs.kinetica.com/content/api/javascript/types/GPUdbCallback.md)

        Optional callback function
      </li>
    </ul>

    #### Returns Promise\<[CreateTableResponse](https://docs.kinetica.com/content/api/javascript/interfaces/CreateTableResponse.md)>

    Promise\<Types.CreateTableResponse> - Promise resolving to the response

    <ul>
      <li>Defined in [src/GPUdb.ts:6933](https://github.com/kineticadb/kinetica-api-typescript/blob/master/src/GPUdb.ts#L6933)</li>
    </ul>
  </li>
</ul>

### create\_table\_request

<ul>
  <li>
    create\_table\_request(\
    &#x20;request: [CreateTableRequest](https://docs.kinetica.com/content/api/javascript/interfaces/CreateTableRequest.md),\
    &#x20;callback?: [GPUdbCallback](https://docs.kinetica.com/content/api/javascript/types/GPUdbCallback.md),\
    ): Promise\<[CreateTableResponse](https://docs.kinetica.com/content/api/javascript/interfaces/CreateTableResponse.md)>

    Creates a new table with the given type (definition of columns). The type is specified in `type_id` as either a numerical type ID (as returned by `create_type`) or as a list of columns, each specified as a list of the column name, data type, and any column attributes.Example of a type definition with some parameters::

    ```
    [
        ["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"]
    ]
    ```

    Each column definition consists of the column name (which should meet the standard column naming criteria), the column's specific type (int, long, float, double, string, bytes, or any of the properties map values from `create_type`), and any data handling, data key, or data replacement properties.A table may optionally be designated to use a replicated distribution scheme, or be assigned: foreign keys to other tables, a partitioning scheme, and/or a tier strategy.

    #### Parameters

    <ul>
      <li>
        request: [CreateTableRequest](https://docs.kinetica.com/content/api/javascript/interfaces/CreateTableRequest.md)

        Request object containing the parameters for the operation
      </li>

      <li>
        `Optional`callback: [GPUdbCallback](https://docs.kinetica.com/content/api/javascript/types/GPUdbCallback.md)

        Optional callback function
      </li>
    </ul>

    #### Returns Promise\<[CreateTableResponse](https://docs.kinetica.com/content/api/javascript/interfaces/CreateTableResponse.md)>

    Promise\<Types.CreateTableResponse> - Promise resolving to the response

    <ul>
      <li>Defined in [src/GPUdb.ts:6877](https://github.com/kineticadb/kinetica-api-typescript/blob/master/src/GPUdb.ts#L6877)</li>
    </ul>
  </li>
</ul>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.