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

# execute_sql

### execute\_sql

<ul>
  <li>
    execute\_sql(\
    &#x20;statement: string,\
    &#x20;offset?: number,\
    &#x20;limit?: number,\
    &#x20;request\_schema\_str?: string,\
    &#x20;data?: string\[],\
    &#x20;options?: Record\<string, string>,\
    &#x20;callback?: [GPUdbCallback](https://docs.kinetica.com/content/api/typescript/types/GPUdbCallback.md),\
    ): Promise\<[ExecuteSqlResponse](https://docs.kinetica.com/content/api/typescript/interfaces/ExecuteSqlResponse.md)>

    Execute a SQL statement (query, DML, or DDL).See SQL Support for the complete set of supported SQL commands.When a caller wants all the results from a large query (e.g., more than max\_get\_records\_size records), they can make multiple calls to this endpoint using the `offset` and `limit` parameters to page through the results. Normally, this will execute the `statement` query each time. To avoid re-executing the query each time and to keep the results in the same order, the caller should specify a paging\_table name to hold the results of the query between calls and specify the paging\_table on subsequent calls. When this is done, the caller should clear the paging table and any other tables in the result\_table\_list (both returned in the response) when they are done paging through the results. `paging_table` (and result\_table\_list) will be empty if no paging table was created (e.g., when all the query results were returned in the first call).

    #### Parameters

    <ul>
      <li>
        statement: string

        SQL statement (query, DML, or DDL) to be executed.
      </li>

      <li>
        `Optional`offset: number

        A positive integer indicating the number of initial results to skip (this can be useful for paging through the results).
      </li>

      <li>
        `Optional`limit: number

        A positive integer indicating the maximum number of results to be returned, or END\_OF\_SET (-9999) to indicate that the maximum number of results allowed by the server should be returned. The number of records returned will never exceed the server's own limit, defined by the max\_get\_records\_size parameter in the server configuration. Use `has_more_records` to see if more records exist in the result to be fetched, and `offset` and `limit` to request subsequent pages of results.
      </li>

      <li>
        `Optional`request\_schema\_str: string

        Avro schema of `data`.
      </li>

      <li>
        `Optional`data: string\[]

        An array of binary-encoded data for the records to be binded to the SQL query. Or use query\_parameters to pass the data in JSON format.
      </li>

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

        Optional parameters.
      </li>

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

        Optional callback function
      </li>
    </ul>

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

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

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

### execute\_sql\_request

<ul>
  <li>
    execute\_sql\_request(\
    &#x20;request: [ExecuteSqlRequest](https://docs.kinetica.com/content/api/typescript/interfaces/ExecuteSqlRequest.md),\
    &#x20;callback?: [GPUdbCallback](https://docs.kinetica.com/content/api/typescript/types/GPUdbCallback.md),\
    ): Promise\<[ExecuteSqlResponse](https://docs.kinetica.com/content/api/typescript/interfaces/ExecuteSqlResponse.md)>

    Execute a SQL statement (query, DML, or DDL).See SQL Support for the complete set of supported SQL commands.When a caller wants all the results from a large query (e.g., more than max\_get\_records\_size records), they can make multiple calls to this endpoint using the `offset` and `limit` parameters to page through the results. Normally, this will execute the `statement` query each time. To avoid re-executing the query each time and to keep the results in the same order, the caller should specify a paging\_table name to hold the results of the query between calls and specify the paging\_table on subsequent calls. When this is done, the caller should clear the paging table and any other tables in the result\_table\_list (both returned in the response) when they are done paging through the results. `paging_table` (and result\_table\_list) will be empty if no paging table was created (e.g., when all the query results were returned in the first call).

    #### Parameters

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

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

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

        Optional callback function
      </li>
    </ul>

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

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

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


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