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

# createUnion

<div className="kinetica-javadoc">
  <ul className="member-list">
    <li>
      <div className="section detail" id="createUnion(com.gpudb.protocol.CreateUnionRequest)">
        <h3>createUnion</h3>
        <div className="member-signature"><span className="modifiers">public</span> <span className="return-type"><a href="/content/api/java/com/gpudb/protocol/CreateUnionResponse" title="class in com.gpudb.protocol">CreateUnionResponse</a></span> <span className="element-name">createUnion</span><wbr /><span className="parameters">(<a href="/content/api/java/com/gpudb/protocol/CreateUnionRequest" title="class in com.gpudb.protocol">CreateUnionRequest</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">
          Merges data from one or more tables with comparable data types into a new table.
          <p> The following merges are supported: </p>
          <p> UNION (DISTINCT/ALL) - For data set union details and examples, see <a href="/content/concepts/unions/" target="_top">Union</a>. For limitations, see <a href="/content/concepts/unions/#limitations-and-cautions" target="_top">Union Limitations and Cautions</a>. </p>
          <p> INTERSECT (DISTINCT/ALL) - For data set intersection details and examples, see <a href="/content/concepts/intersect/" target="_top">Intersect</a>. For limitations, see <a href="/content/concepts/intersect/#limitations" target="_top">Intersect Limitations</a>. </p>
          <p> EXCEPT (DISTINCT/ALL) - For data set subtraction details and examples, see <a href="/content/concepts/except/" target="_top">Except</a>. For limitations, see <a href="/content/concepts/except/#limitations" target="_top">Except Limitations</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/CreateUnionRequest" 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/CreateUnionResponse" 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="createUnion(java.lang.String,java.util.List,java.util.List,java.util.List,java.util.Map)">
        <h3>createUnion</h3>
        <div className="member-signature"><span className="modifiers">public</span> <span className="return-type"><a href="/content/api/java/com/gpudb/protocol/CreateUnionResponse" title="class in com.gpudb.protocol">CreateUnionResponse</a></span> <span className="element-name">createUnion</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/util/List.html" title="class or interface in java.util" className="external-link">List</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>> tableNames, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html" title="class or interface in java.util" className="external-link">List</a>\<<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html" title="class or interface in java.util" className="external-link">List</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>>> inputColumnNames, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html" title="class or interface in java.util" className="external-link">List</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>> outputColumnNames, <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">
          Merges data from one or more tables with comparable data types into a new table.
          <p> The following merges are supported: </p>
          <p> UNION (DISTINCT/ALL) - For data set union details and examples, see <a href="/content/concepts/unions/" target="_top">Union</a>. For limitations, see <a href="/content/concepts/unions/#limitations-and-cautions" target="_top">Union Limitations and Cautions</a>. </p>
          <p> INTERSECT (DISTINCT/ALL) - For data set intersection details and examples, see <a href="/content/concepts/intersect/" target="_top">Intersect</a>. For limitations, see <a href="/content/concepts/intersect/#limitations" target="_top">Intersect Limitations</a>. </p>
          <p> EXCEPT (DISTINCT/ALL) - For data set subtraction details and examples, see <a href="/content/concepts/except/" target="_top">Except</a>. For limitations, see <a href="/content/concepts/except/#limitations" target="_top">Except Limitations</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>.</div>
          <div className="dd"><code>tableNames</code> - The list of table names to merge, in \[schema\_name.]table\_name format, using standard <a href="/content/concepts/tables/#table-name-resolution" target="_top">name resolution rules</a>. Must contain the names of one or more existing tables.</div>
          <div className="dd"><code>inputColumnNames</code> - The list of columns from each of the corresponding input tables.</div>
          <div className="dd"><code>outputColumnNames</code> - The list of names of the columns to be stored in the output table.</div>

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

            <ul>
              <li>
                <a href="/content/api/java/com/gpudb/protocol/CreateUnionRequest.Options#CREATE_TEMP_TABLE"><code>CREATE\_TEMP\_TABLE</code></a>: If <a href="/content/api/java/com/gpudb/protocol/CreateUnionRequest.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/CreateUnionRequest.Options#PERSIST"><code>PERSIST</code></a> is <a href="/content/api/java/com/gpudb/protocol/CreateUnionRequest.Options#FALSE"><code>FALSE</code></a> (or unspecified), 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/CreateUnionResponse.Info#QUALIFIED_TABLE_NAME"><code>QUALIFIED\_TABLE\_NAME</code></a>. Supported values:

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

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

              <li><a href="/content/api/java/com/gpudb/protocol/CreateUnionRequest.Options#COLLECTION_NAME"><code>COLLECTION\_NAME</code></a>: \[DEPRECATED--please specify the containing schema for the projection 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 the schema for the output table. If the schema provided is non-existent, it will be automatically created. The default value is ''. </li>

              <li>
                <a href="/content/api/java/com/gpudb/protocol/CreateUnionRequest.Options#MODE"><code>MODE</code></a>: The mode describes what rows of the tables being unioned will be retained. Supported values:

                <ul>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateUnionRequest.Options#UNION_ALL"><code>UNION\_ALL</code></a>: Retains all rows from the specified tables. </li>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateUnionRequest.Options#UNION"><code>UNION</code></a>: Retains all unique rows from the specified tables (synonym for <a href="/content/api/java/com/gpudb/protocol/CreateUnionRequest.Options#UNION_DISTINCT"><code>UNION\_DISTINCT</code></a>). </li>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateUnionRequest.Options#UNION_DISTINCT"><code>UNION\_DISTINCT</code></a>: Retains all unique rows from the specified tables. </li>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateUnionRequest.Options#EXCEPT"><code>EXCEPT</code></a>: Retains all unique rows from the first table that do not appear in the second table (only works on 2 tables). </li>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateUnionRequest.Options#EXCEPT_ALL"><code>EXCEPT\_ALL</code></a>: Retains all rows(including duplicates) from the first table that do not appear in the second table (only works on 2 tables). </li>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateUnionRequest.Options#INTERSECT"><code>INTERSECT</code></a>: Retains all unique rows that appear in both of the specified tables (only works on 2 tables). </li>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateUnionRequest.Options#INTERSECT_ALL"><code>INTERSECT\_ALL</code></a>: Retains all rows(including duplicates) that appear in both of the specified tables (only works on 2 tables). </li>
                </ul>

                The default value is <a href="/content/api/java/com/gpudb/protocol/CreateUnionRequest.Options#UNION_ALL"><code>UNION\_ALL</code></a>.
              </li>

              <li><a href="/content/api/java/com/gpudb/protocol/CreateUnionRequest.Options#CHUNK_SIZE"><code>CHUNK\_SIZE</code></a>: Indicates the number of records per chunk to be used for this output table. </li>
              <li><a href="/content/api/java/com/gpudb/protocol/CreateUnionRequest.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 output table. </li>
              <li><a href="/content/api/java/com/gpudb/protocol/CreateUnionRequest.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 output table. </li>
              <li><a href="/content/api/java/com/gpudb/protocol/CreateUnionRequest.Options#CREATE_INDEXES"><code>CREATE\_INDEXES</code></a>: Comma-separated list of columns on which to create indexes on the output table. The columns specified must be present in <code> outputColumnNames</code>. </li>

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

                <ul>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateUnionRequest.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/CreateUnionRequest.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/CreateUnionRequest.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/CreateUnionRequest.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/CreateUnionRequest.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/CreateUnionRequest.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/CreateUnionRequest.Options#PARTITION_DEFINITIONS"><code>PARTITION\_DEFINITIONS</code></a>. </li>
              <li><a href="/content/api/java/com/gpudb/protocol/CreateUnionRequest.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/CreateUnionRequest.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/CreateUnionRequest.Options#IS_AUTOMATIC_PARTITION"><code>IS\_AUTOMATIC\_PARTITION</code></a>: If <a href="/content/api/java/com/gpudb/protocol/CreateUnionRequest.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/CreateUnionRequest.Options#TRUE"><code>TRUE</code></a> </li>
                  <li><a href="/content/api/java/com/gpudb/protocol/CreateUnionRequest.Options#FALSE"><code>FALSE</code></a> </li>
                </ul>

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

              <li><a href="/content/api/java/com/gpudb/protocol/CreateUnionRequest.Options#TTL"><code>TTL</code></a>: Sets the <a href="/content/concepts/ttl/" target="_top">TTL</a> of the output table specified in <code>tableName</code>. </li>

              <li>
                <a href="/content/api/java/com/gpudb/protocol/CreateUnionRequest.Options#PERSIST"><code>PERSIST</code></a>: If <a href="/content/api/java/com/gpudb/protocol/CreateUnionRequest.Options#TRUE"><code>TRUE</code></a>, then the output table specified in <code> tableName</code> will be persisted and will not expire unless a <a href="/content/api/java/com/gpudb/protocol/CreateUnionRequest.Options#TTL"><code>TTL</code></a> is specified. If <a href="/content/api/java/com/gpudb/protocol/CreateUnionRequest.Options#FALSE"><code>FALSE</code></a>, then the output table will be an in-memory table and will expire unless a <a href="/content/api/java/com/gpudb/protocol/CreateUnionRequest.Options#TTL"><code>TTL</code></a> is specified otherwise. Supported values:

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

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

              <li><a href="/content/api/java/com/gpudb/protocol/CreateUnionRequest.Options#VIEW_ID"><code>VIEW\_ID</code></a>: ID of view of which this output table is a member. The default value is ''. </li>

              <li>
                <a href="/content/api/java/com/gpudb/protocol/CreateUnionRequest.Options#FORCE_REPLICATED"><code>FORCE\_REPLICATED</code></a>: If <a href="/content/api/java/com/gpudb/protocol/CreateUnionRequest.Options#TRUE"><code>TRUE</code></a>, then the output table specified in <code> tableName</code> will be replicated even if the source tables are not. Supported values:

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

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

              <li><a href="/content/api/java/com/gpudb/protocol/CreateUnionRequest.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/CreateUnionRequest.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/CreateUnionRequest.Options#NO_COUNT"><code>NO\_COUNT</code></a>: Return a count of 0 for the union table response to avoid the cost of counting; optimization needed for many chunk virtual unions. The default value is 'false'. </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/CreateUnionResponse" 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>
