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

### create\_projection

<ul>
  <li>
    create\_projection(\
    &#x20;table\_name: string,\
    &#x20;projection\_name: string,\
    &#x20;column\_names: string\[],\
    &#x20;options?: Record\<string, string>,\
    &#x20;callback?: [GPUdbCallback](https://docs.kinetica.com/content/api/nodejs/types/GPUdbCallback.md),\
    ): Promise\<[CreateProjectionResponse](https://docs.kinetica.com/content/api/nodejs/interfaces/CreateProjectionResponse.md)>

    Creates a new projection of an existing table. A projection represents a subset of the columns (potentially including derived columns) of a table.For projection details and examples, see Projections. For limitations, see Projection Limitations and Cautions.Window functions, which can perform operations like moving averages, are available through this endpoint as well as `get_records_by_column`.A projection can be created with a different shard key than the source table. By specifying shard\_key, the projection will be sharded according to the specified columns, regardless of how the source table is sharded. The source table can even be unsharded or replicated.If `table_name` is empty, selection is performed against a single-row virtual table. This can be useful in executing temporal (NOW()), identity (USER()), or constant-based functions (GEODIST(-77.11, 38.88, -71.06, 42.36)).

    #### Parameters

    <ul>
      <li>
        table\_name: string

        Name of the existing table on which the projection is to be applied, in \[schema\_name.]table\_name format, using standard name resolution rules. An empty table name creates a projection from a single-row virtual table, where columns specified should be constants or constant expressions.
      </li>

      <li>
        projection\_name: string

        Name of the projection to be created, in \[schema\_name.]table\_name format, using standard name resolution rules and meeting table naming criteria.
      </li>

      <li>
        column\_names: string\[]

        List of columns from `table_name` to be included in the projection. Can include derived columns. Can be specified as aliased via the syntax 'column\_name as alias'.
      </li>

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

        Optional parameters.
      </li>

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

        Optional callback function
      </li>
    </ul>

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

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

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

### create\_projection\_request

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

    Creates a new projection of an existing table. A projection represents a subset of the columns (potentially including derived columns) of a table.For projection details and examples, see Projections. For limitations, see Projection Limitations and Cautions.Window functions, which can perform operations like moving averages, are available through this endpoint as well as `get_records_by_column`.A projection can be created with a different shard key than the source table. By specifying shard\_key, the projection will be sharded according to the specified columns, regardless of how the source table is sharded. The source table can even be unsharded or replicated.If `table_name` is empty, selection is performed against a single-row virtual table. This can be useful in executing temporal (NOW()), identity (USER()), or constant-based functions (GEODIST(-77.11, 38.88, -71.06, 42.36)).

    #### Parameters

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

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

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

        Optional callback function
      </li>
    </ul>

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

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

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


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