> ## 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-doxygen">
  <div id="af715d41bccfba570e4e335da030f8576" />

  <h2 className="memtitle"><span className="permalink"><a href="#af715d41bccfba570e4e335da030f8576">◆ </a></span>createUnion() <span className="overload">\[1/4]</span></h2>

  <div className="memitem">
    <div className="memproto">
      <table className="memname">
        <tr>
          <td className="memname"><a className="el" href="/content/api/cpp/structgpudb_1_1CreateUnionResponse">CreateUnionResponse</a> gpudb::GPUdb::createUnion </td>
          <td>(</td>
          <td className="paramtype">const <a className="el" href="/content/api/cpp/structgpudb_1_1CreateUnionRequest">CreateUnionRequest</a> &</td>
          <td className="paramname"><span className="paramname"><span className="em">request\_</span></span></td>
          <td>)</td>
          <td> const</td>
        </tr>
      </table>
    </div>

    <div className="memdoc">
      <p>Merges data from one or more tables with comparable data types into a new table. </p>
      <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 className="dl params">
        <div className="dt">Parameters</div>

        <div className="dd">
          <table className="params">
            <tr>
              <td className="paramdir">\[in]</td>
              <td className="paramname">request\_</td>
              <td><a className="el" href="/content/api/cpp/structgpudb_1_1CreateUnionRequest">Request</a> object containing the parameters for the operation.</td>
            </tr>
          </table>
        </div>
      </div>

      <div className="dl section return">
        <div className="dt">Returns</div>
        <div className="dd"><a className="el" href="/content/api/cpp/structgpudb_1_1CreateUnionResponse">Response</a> object containing the result of the operation. </div>
      </div>
    </div>
  </div>

  <div id="ab65629316eb66dee1c6b8998423c46e6" />

  <h2 className="memtitle"><span className="permalink"><a href="#ab65629316eb66dee1c6b8998423c46e6">◆ </a></span>createUnion() <span className="overload">\[2/4]</span></h2>

  <div className="memitem">
    <div className="memproto">
      <table className="memname">
        <tr>
          <td className="memname"><a className="el" href="/content/api/cpp/structgpudb_1_1CreateUnionResponse">CreateUnionResponse</a> & gpudb::GPUdb::createUnion </td>
          <td>(</td>
          <td className="paramtype">const <a className="el" href="/content/api/cpp/structgpudb_1_1CreateUnionRequest">CreateUnionRequest</a> &</td>
          <td className="paramname"><span className="paramname"><span className="em">request\_</span></span>, </td>
        </tr>

        <tr>
          <td className="paramkey" />

          <td />

          <td className="paramtype"><a className="el" href="/content/api/cpp/structgpudb_1_1CreateUnionResponse">CreateUnionResponse</a> &</td>
          <td className="paramname"><span className="paramname"><span className="em">response\_</span></span> ) const</td>
        </tr>
      </table>
    </div>

    <div className="memdoc">
      <p>Merges data from one or more tables with comparable data types into a new table. </p>
      <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 className="dl params">
        <div className="dt">Parameters</div>

        <div className="dd">
          <table className="params">
            <tr>
              <td className="paramdir">\[in]</td>
              <td className="paramname">request\_</td>
              <td><a className="el" href="/content/api/cpp/structgpudb_1_1CreateUnionRequest">Request</a> object containing the parameters for the operation. </td>
            </tr>

            <tr>
              <td className="paramdir">\[out]</td>
              <td className="paramname">response\_</td>
              <td><a className="el" href="/content/api/cpp/structgpudb_1_1CreateUnionResponse">Response</a> object containing the results of the operation.</td>
            </tr>
          </table>
        </div>
      </div>

      <div className="dl section return">
        <div className="dt">Returns</div>
        <div className="dd"><a className="el" href="/content/api/cpp/structgpudb_1_1CreateUnionResponse">Response</a> object containing the result of the operation (initially passed in by reference). </div>
      </div>
    </div>
  </div>

  <div id="ad46a1ca661db2c102c37940364563143" />

  <h2 className="memtitle"><span className="permalink"><a href="#ad46a1ca661db2c102c37940364563143">◆ </a></span>createUnion() <span className="overload">\[3/4]</span></h2>

  <div className="memitem">
    <div className="memproto">
      <table className="memname">
        <tr>
          <td className="memname"><a className="el" href="/content/api/cpp/structgpudb_1_1CreateUnionResponse">CreateUnionResponse</a> gpudb::GPUdb::createUnion </td>
          <td>(</td>
          <td className="paramtype">const std::string &</td>
          <td className="paramname"><span className="paramname"><span className="em">tableName</span></span>, </td>
        </tr>

        <tr>
          <td className="paramkey" />

          <td />

          <td className="paramtype">const std::vector\< std::string > &</td>
          <td className="paramname"><span className="paramname"><span className="em">tableNames</span></span>, </td>
        </tr>

        <tr>
          <td className="paramkey" />

          <td />

          <td className="paramtype">const std::vector\< std::vector\< std::string > > &</td>
          <td className="paramname"><span className="paramname"><span className="em">inputColumnNames</span></span>, </td>
        </tr>

        <tr>
          <td className="paramkey" />

          <td />

          <td className="paramtype">const std::vector\< std::string > &</td>
          <td className="paramname"><span className="paramname"><span className="em">outputColumnNames</span></span>, </td>
        </tr>

        <tr>
          <td className="paramkey" />

          <td />

          <td className="paramtype">const std::map\< std::string, std::string > &</td>
          <td className="paramname"><span className="paramname"><span className="em">options</span></span> ) const</td>
        </tr>
      </table>
    </div>

    <div className="memdoc">
      <p>Merges data from one or more tables with comparable data types into a new table. </p>
      <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 className="dl params">
        <div className="dt">Parameters</div>

        <div className="dd">
          <table className="params">
            <tr>
              <td className="paramdir">\[in]</td>
              <td className="paramname">tableName</td>
              <td>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>. </td>
            </tr>

            <tr>
              <td className="paramdir">\[in]</td>
              <td className="paramname">tableNames</td>
              <td>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. </td>
            </tr>

            <tr>
              <td className="paramdir">\[in]</td>
              <td className="paramname">inputColumnNames</td>
              <td>The list of columns from each of the corresponding input tables. </td>
            </tr>

            <tr>
              <td className="paramdir">\[in]</td>
              <td className="paramname">outputColumnNames</td>
              <td>The list of names of the columns to be stored in the output table. </td>
            </tr>

            <tr>
              <td className="paramdir">\[in]</td>
              <td className="paramname">options</td>

              <td>
                Optional parameters.

                <ul>
                  <li>
                    <a className="el" href="/content/api/cpp/namespacegpudb#ae7a132ec4d309fafdc6282b5b988c630">create\_union\_create\_temp\_table</a>: If <a className="el" href="/content/api/cpp/namespacegpudb#a4c679573328605dc89476ea85fbe6e87">true</a>, a unique temporary table name will be generated in the sys\_temp schema and used in place of <span className="em arg">tableName</span>. If <a className="el" href="/content/api/cpp/namespacegpudb#a9773f20de01667f4a54a013287125d6d">persist</a> is <a className="el" href="/content/api/cpp/namespacegpudb#a3196fd11fabb927d36a20e258903b566">false</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 className="el" href="/content/api/cpp/namespacegpudb#a584f96f298fb8560e416d7aa5d12696f">qualified\_table\_name</a>. Supported values:

                    <ul>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#a4c679573328605dc89476ea85fbe6e87">create\_union\_true</a> </li>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#a3196fd11fabb927d36a20e258903b566">create\_union\_false</a> </li>
                    </ul>

                    The default value is <a className="el" href="/content/api/cpp/namespacegpudb#a3196fd11fabb927d36a20e258903b566">create\_union\_false</a>.
                  </li>

                  <li> <a className="el" href="/content/api/cpp/namespacegpudb#a51ad8919e170db36635d44e753ffb3ca">create\_union\_collection\_name</a>: \[DEPRECATED–please specify the containing schema for the projection as part of <span className="em arg">tableName</span> and use <a className="el" href="#a33d9a0a8e738d14b688f9f869f9640ad">createSchema</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 className="el" href="/content/api/cpp/namespacegpudb#adeb5407c9e89bd6fbbb6aca40b39d544">create\_union\_mode</a>: The mode describes what rows of the tables being unioned will be retained. Supported values:

                    <ul>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#a4d30935577318d7b1b764224cabca31b">create\_union\_union\_all</a>: Retains all rows from the specified tables. </li>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#a15a6fc2ec7a782dc2d6192a08cb6a4a9">create\_union\_union</a>: Retains all unique rows from the specified tables (synonym for <a className="el" href="/content/api/cpp/namespacegpudb#a7a186e3a270e41a99cf4d3517e892257">union\_distinct</a>). </li>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#a7a186e3a270e41a99cf4d3517e892257">create\_union\_union\_distinct</a>: Retains all unique rows from the specified tables. </li>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#a2ef70a26679f465ecdb580dfc326910e">create\_union\_except</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 className="el" href="/content/api/cpp/namespacegpudb#a06baad96a6f886c6843b9ab4f18ab297">create\_union\_except\_all</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 className="el" href="/content/api/cpp/namespacegpudb#a9faa32e71c7c836805f660cd15c439f3">create\_union\_intersect</a>: Retains all unique rows that appear in both of the specified tables (only works on 2 tables). </li>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#a98f20f503e4401f9d21db59fca19d05f">create\_union\_intersect\_all</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 className="el" href="/content/api/cpp/namespacegpudb#a4d30935577318d7b1b764224cabca31b">create\_union\_union\_all</a>.
                  </li>

                  <li> <a className="el" href="/content/api/cpp/namespacegpudb#a4e4b51e85582c38d91def6f4980f659d">create\_union\_chunk\_size</a>: Indicates the number of records per chunk to be used for this output table. </li>
                  <li> <a className="el" href="/content/api/cpp/namespacegpudb#a6e878bfd26260961c6ca97993a840b90">create\_union\_chunk\_column\_max\_memory</a>: Indicates the target maximum data size for each column in a chunk to be used for this output table. </li>
                  <li> <a className="el" href="/content/api/cpp/namespacegpudb#ab0f79cbd7c82bf7b2066402d9678720d">create\_union\_chunk\_max\_memory</a>: Indicates the target maximum data size for all columns in a chunk to be used for this output table. </li>
                  <li> <a className="el" href="/content/api/cpp/namespacegpudb#a62165dc74b434196fdc35f7687d53323">create\_union\_create\_indexes</a>: Comma-separated list of columns on which to create indexes on the output table. The columns specified must be present in <span className="em arg">outputColumnNames</span>. </li>

                  <li>
                    <a className="el" href="/content/api/cpp/namespacegpudb#a81ea337287743114191da31177f0ae8c">create\_union\_partition\_type</a>: <a href="/content/concepts/tables/#partitioning" target="_top">Partitioning</a> scheme to use for the output table. Supported values:

                    <ul>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#a2f9f59cda9f30cd52196fb1af2070d11">create\_union\_RANGE</a>: Use <a href="/content/concepts/tables/#partitioning-by-range" target="_top">range partitioning</a>. </li>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#ac5b5c374e1e5921ca5dbd9d329bba044">create\_union\_INTERVAL</a>: Use <a href="/content/concepts/tables/#partitioning-by-interval" target="_top">interval partitioning</a>. </li>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#a9a5c2ca46cef489d66e37ed151f6b082">create\_union\_LIST</a>: Use <a href="/content/concepts/tables/#partitioning-by-list" target="_top">list partitioning</a>. </li>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#ad27f73eb5bd1b39f9987ab3f3be24991">create\_union\_HASH</a>: Use <a href="/content/concepts/tables/#partitioning-by-hash" target="_top">hash partitioning</a>. </li>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#a71df92ff17c7d81957523718355bda22">create\_union\_SERIES</a>: Use <a href="/content/concepts/tables/#partitioning-by-series" target="_top">series partitioning</a>. </li>
                    </ul>
                  </li>

                  <li> <a className="el" href="/content/api/cpp/namespacegpudb#a60fe727d9f5a7c2e143f45f352ad1552">create\_union\_partition\_keys</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 className="el" href="/content/api/cpp/namespacegpudb#a145a5a32a5fea1df0e4ff29eddcdb299">partition\_definitions</a>. </li>
                  <li> <a className="el" href="/content/api/cpp/namespacegpudb#a145a5a32a5fea1df0e4ff29eddcdb299">create\_union\_partition\_definitions</a>: Comma-separated list of partition definitions, whose format depends on the choice of <a className="el" href="/content/api/cpp/namespacegpudb#a81ea337287743114191da31177f0ae8c">partition\_type</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 className="el" href="/content/api/cpp/namespacegpudb#a864937e3c3accf3db0196678e5d43d82">create\_union\_is\_automatic\_partition</a>: If <a className="el" href="/content/api/cpp/namespacegpudb#a4c679573328605dc89476ea85fbe6e87">true</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 className="el" href="/content/api/cpp/namespacegpudb#a4c679573328605dc89476ea85fbe6e87">create\_union\_true</a> </li>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#a3196fd11fabb927d36a20e258903b566">create\_union\_false</a> </li>
                    </ul>

                    The default value is <a className="el" href="/content/api/cpp/namespacegpudb#a3196fd11fabb927d36a20e258903b566">create\_union\_false</a>.
                  </li>

                  <li> <a className="el" href="/content/api/cpp/namespacegpudb#ae26c0d26d90ab3efc46df04a3b6f5d82">create\_union\_ttl</a>: Sets the <a href="/content/concepts/ttl/" target="_top">TTL</a> of the output table specified in <span className="em arg">tableName</span>. </li>

                  <li>
                    <a className="el" href="/content/api/cpp/namespacegpudb#a9773f20de01667f4a54a013287125d6d">create\_union\_persist</a>: If <a className="el" href="/content/api/cpp/namespacegpudb#a4c679573328605dc89476ea85fbe6e87">true</a>, then the output table specified in <span className="em arg">tableName</span> will be persisted and will not expire unless a <a className="el" href="/content/api/cpp/namespacegpudb#ae26c0d26d90ab3efc46df04a3b6f5d82">ttl</a> is specified. If <a className="el" href="/content/api/cpp/namespacegpudb#a3196fd11fabb927d36a20e258903b566">false</a>, then the output table will be an in-memory table and will expire unless a <a className="el" href="/content/api/cpp/namespacegpudb#ae26c0d26d90ab3efc46df04a3b6f5d82">ttl</a> is specified otherwise. Supported values:

                    <ul>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#a4c679573328605dc89476ea85fbe6e87">create\_union\_true</a> </li>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#a3196fd11fabb927d36a20e258903b566">create\_union\_false</a> </li>
                    </ul>

                    The default value is <a className="el" href="/content/api/cpp/namespacegpudb#a3196fd11fabb927d36a20e258903b566">create\_union\_false</a>.
                  </li>

                  <li> <a className="el" href="/content/api/cpp/namespacegpudb#a121d9344dd13b32115aae87091b60719">create\_union\_view\_id</a>: ID of view of which this output table is a member. The default value is ''. </li>

                  <li>
                    <a className="el" href="/content/api/cpp/namespacegpudb#a44773403e73d309d0a9ce8584d7f8ed0">create\_union\_force\_replicated</a>: If <a className="el" href="/content/api/cpp/namespacegpudb#a4c679573328605dc89476ea85fbe6e87">true</a>, then the output table specified in <span className="em arg">tableName</span> will be replicated even if the source tables are not. Supported values:

                    <ul>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#a4c679573328605dc89476ea85fbe6e87">create\_union\_true</a> </li>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#a3196fd11fabb927d36a20e258903b566">create\_union\_false</a> </li>
                    </ul>

                    The default value is <a className="el" href="/content/api/cpp/namespacegpudb#a3196fd11fabb927d36a20e258903b566">create\_union\_false</a>.
                  </li>

                  <li> <a className="el" href="/content/api/cpp/namespacegpudb#ac00533b09c4716e5648374f898a6d14f">create\_union\_strategy\_definition</a>: The <a href="/content/rm/concepts/#tier-strategies" target="_top">tier strategy</a> for the table and its columns. </li>
                  <li> <a className="el" href="/content/api/cpp/namespacegpudb#aeeae3d1a145f68adb1aca9d363af98ae">create\_union\_compression\_codec</a>: The default <a href="/content/concepts/column_compression/" target="_top">compression codec</a> for this table's columns. </li>
                  <li> <a className="el" href="/content/api/cpp/namespacegpudb#add05709137466e254cb09aa39e9655bd">create\_union\_no\_count</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 map.
              </td>
            </tr>
          </table>
        </div>
      </div>

      <div className="dl section return">
        <div className="dt">Returns</div>
        <div className="dd"><a className="el" href="/content/api/cpp/structgpudb_1_1CreateUnionResponse">Response</a> object containing the result of the operation. </div>
      </div>
    </div>
  </div>

  <div id="a77e0ada501f72a9c0bde63922fdcf77d" />

  <h2 className="memtitle"><span className="permalink"><a href="#a77e0ada501f72a9c0bde63922fdcf77d">◆ </a></span>createUnion() <span className="overload">\[4/4]</span></h2>

  <div className="memitem">
    <div className="memproto">
      <table className="memname">
        <tr>
          <td className="memname"><a className="el" href="/content/api/cpp/structgpudb_1_1CreateUnionResponse">CreateUnionResponse</a> & gpudb::GPUdb::createUnion </td>
          <td>(</td>
          <td className="paramtype">const std::string &</td>
          <td className="paramname"><span className="paramname"><span className="em">tableName</span></span>, </td>
        </tr>

        <tr>
          <td className="paramkey" />

          <td />

          <td className="paramtype">const std::vector\< std::string > &</td>
          <td className="paramname"><span className="paramname"><span className="em">tableNames</span></span>, </td>
        </tr>

        <tr>
          <td className="paramkey" />

          <td />

          <td className="paramtype">const std::vector\< std::vector\< std::string > > &</td>
          <td className="paramname"><span className="paramname"><span className="em">inputColumnNames</span></span>, </td>
        </tr>

        <tr>
          <td className="paramkey" />

          <td />

          <td className="paramtype">const std::vector\< std::string > &</td>
          <td className="paramname"><span className="paramname"><span className="em">outputColumnNames</span></span>, </td>
        </tr>

        <tr>
          <td className="paramkey" />

          <td />

          <td className="paramtype">const std::map\< std::string, std::string > &</td>
          <td className="paramname"><span className="paramname"><span className="em">options</span></span>, </td>
        </tr>

        <tr>
          <td className="paramkey" />

          <td />

          <td className="paramtype"><a className="el" href="/content/api/cpp/structgpudb_1_1CreateUnionResponse">CreateUnionResponse</a> &</td>
          <td className="paramname"><span className="paramname"><span className="em">response\_</span></span> ) const</td>
        </tr>
      </table>
    </div>

    <div className="memdoc">
      <p>Merges data from one or more tables with comparable data types into a new table. </p>
      <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 className="dl params">
        <div className="dt">Parameters</div>

        <div className="dd">
          <table className="params">
            <tr>
              <td className="paramdir">\[in]</td>
              <td className="paramname">tableName</td>
              <td>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>. </td>
            </tr>

            <tr>
              <td className="paramdir">\[in]</td>
              <td className="paramname">tableNames</td>
              <td>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. </td>
            </tr>

            <tr>
              <td className="paramdir">\[in]</td>
              <td className="paramname">inputColumnNames</td>
              <td>The list of columns from each of the corresponding input tables. </td>
            </tr>

            <tr>
              <td className="paramdir">\[in]</td>
              <td className="paramname">outputColumnNames</td>
              <td>The list of names of the columns to be stored in the output table. </td>
            </tr>

            <tr>
              <td className="paramdir">\[in]</td>
              <td className="paramname">options</td>

              <td>
                Optional parameters.

                <ul>
                  <li>
                    <a className="el" href="/content/api/cpp/namespacegpudb#ae7a132ec4d309fafdc6282b5b988c630">create\_union\_create\_temp\_table</a>: If <a className="el" href="/content/api/cpp/namespacegpudb#a4c679573328605dc89476ea85fbe6e87">true</a>, a unique temporary table name will be generated in the sys\_temp schema and used in place of <span className="em arg">tableName</span>. If <a className="el" href="/content/api/cpp/namespacegpudb#a9773f20de01667f4a54a013287125d6d">persist</a> is <a className="el" href="/content/api/cpp/namespacegpudb#a3196fd11fabb927d36a20e258903b566">false</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 className="el" href="/content/api/cpp/namespacegpudb#a584f96f298fb8560e416d7aa5d12696f">qualified\_table\_name</a>. Supported values:

                    <ul>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#a4c679573328605dc89476ea85fbe6e87">create\_union\_true</a> </li>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#a3196fd11fabb927d36a20e258903b566">create\_union\_false</a> </li>
                    </ul>

                    The default value is <a className="el" href="/content/api/cpp/namespacegpudb#a3196fd11fabb927d36a20e258903b566">create\_union\_false</a>.
                  </li>

                  <li> <a className="el" href="/content/api/cpp/namespacegpudb#a51ad8919e170db36635d44e753ffb3ca">create\_union\_collection\_name</a>: \[DEPRECATED–please specify the containing schema for the projection as part of <span className="em arg">tableName</span> and use <a className="el" href="#a33d9a0a8e738d14b688f9f869f9640ad">createSchema</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 className="el" href="/content/api/cpp/namespacegpudb#adeb5407c9e89bd6fbbb6aca40b39d544">create\_union\_mode</a>: The mode describes what rows of the tables being unioned will be retained. Supported values:

                    <ul>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#a4d30935577318d7b1b764224cabca31b">create\_union\_union\_all</a>: Retains all rows from the specified tables. </li>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#a15a6fc2ec7a782dc2d6192a08cb6a4a9">create\_union\_union</a>: Retains all unique rows from the specified tables (synonym for <a className="el" href="/content/api/cpp/namespacegpudb#a7a186e3a270e41a99cf4d3517e892257">union\_distinct</a>). </li>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#a7a186e3a270e41a99cf4d3517e892257">create\_union\_union\_distinct</a>: Retains all unique rows from the specified tables. </li>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#a2ef70a26679f465ecdb580dfc326910e">create\_union\_except</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 className="el" href="/content/api/cpp/namespacegpudb#a06baad96a6f886c6843b9ab4f18ab297">create\_union\_except\_all</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 className="el" href="/content/api/cpp/namespacegpudb#a9faa32e71c7c836805f660cd15c439f3">create\_union\_intersect</a>: Retains all unique rows that appear in both of the specified tables (only works on 2 tables). </li>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#a98f20f503e4401f9d21db59fca19d05f">create\_union\_intersect\_all</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 className="el" href="/content/api/cpp/namespacegpudb#a4d30935577318d7b1b764224cabca31b">create\_union\_union\_all</a>.
                  </li>

                  <li> <a className="el" href="/content/api/cpp/namespacegpudb#a4e4b51e85582c38d91def6f4980f659d">create\_union\_chunk\_size</a>: Indicates the number of records per chunk to be used for this output table. </li>
                  <li> <a className="el" href="/content/api/cpp/namespacegpudb#a6e878bfd26260961c6ca97993a840b90">create\_union\_chunk\_column\_max\_memory</a>: Indicates the target maximum data size for each column in a chunk to be used for this output table. </li>
                  <li> <a className="el" href="/content/api/cpp/namespacegpudb#ab0f79cbd7c82bf7b2066402d9678720d">create\_union\_chunk\_max\_memory</a>: Indicates the target maximum data size for all columns in a chunk to be used for this output table. </li>
                  <li> <a className="el" href="/content/api/cpp/namespacegpudb#a62165dc74b434196fdc35f7687d53323">create\_union\_create\_indexes</a>: Comma-separated list of columns on which to create indexes on the output table. The columns specified must be present in <span className="em arg">outputColumnNames</span>. </li>

                  <li>
                    <a className="el" href="/content/api/cpp/namespacegpudb#a81ea337287743114191da31177f0ae8c">create\_union\_partition\_type</a>: <a href="/content/concepts/tables/#partitioning" target="_top">Partitioning</a> scheme to use for the output table. Supported values:

                    <ul>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#a2f9f59cda9f30cd52196fb1af2070d11">create\_union\_RANGE</a>: Use <a href="/content/concepts/tables/#partitioning-by-range" target="_top">range partitioning</a>. </li>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#ac5b5c374e1e5921ca5dbd9d329bba044">create\_union\_INTERVAL</a>: Use <a href="/content/concepts/tables/#partitioning-by-interval" target="_top">interval partitioning</a>. </li>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#a9a5c2ca46cef489d66e37ed151f6b082">create\_union\_LIST</a>: Use <a href="/content/concepts/tables/#partitioning-by-list" target="_top">list partitioning</a>. </li>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#ad27f73eb5bd1b39f9987ab3f3be24991">create\_union\_HASH</a>: Use <a href="/content/concepts/tables/#partitioning-by-hash" target="_top">hash partitioning</a>. </li>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#a71df92ff17c7d81957523718355bda22">create\_union\_SERIES</a>: Use <a href="/content/concepts/tables/#partitioning-by-series" target="_top">series partitioning</a>. </li>
                    </ul>
                  </li>

                  <li> <a className="el" href="/content/api/cpp/namespacegpudb#a60fe727d9f5a7c2e143f45f352ad1552">create\_union\_partition\_keys</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 className="el" href="/content/api/cpp/namespacegpudb#a145a5a32a5fea1df0e4ff29eddcdb299">partition\_definitions</a>. </li>
                  <li> <a className="el" href="/content/api/cpp/namespacegpudb#a145a5a32a5fea1df0e4ff29eddcdb299">create\_union\_partition\_definitions</a>: Comma-separated list of partition definitions, whose format depends on the choice of <a className="el" href="/content/api/cpp/namespacegpudb#a81ea337287743114191da31177f0ae8c">partition\_type</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 className="el" href="/content/api/cpp/namespacegpudb#a864937e3c3accf3db0196678e5d43d82">create\_union\_is\_automatic\_partition</a>: If <a className="el" href="/content/api/cpp/namespacegpudb#a4c679573328605dc89476ea85fbe6e87">true</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 className="el" href="/content/api/cpp/namespacegpudb#a4c679573328605dc89476ea85fbe6e87">create\_union\_true</a> </li>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#a3196fd11fabb927d36a20e258903b566">create\_union\_false</a> </li>
                    </ul>

                    The default value is <a className="el" href="/content/api/cpp/namespacegpudb#a3196fd11fabb927d36a20e258903b566">create\_union\_false</a>.
                  </li>

                  <li> <a className="el" href="/content/api/cpp/namespacegpudb#ae26c0d26d90ab3efc46df04a3b6f5d82">create\_union\_ttl</a>: Sets the <a href="/content/concepts/ttl/" target="_top">TTL</a> of the output table specified in <span className="em arg">tableName</span>. </li>

                  <li>
                    <a className="el" href="/content/api/cpp/namespacegpudb#a9773f20de01667f4a54a013287125d6d">create\_union\_persist</a>: If <a className="el" href="/content/api/cpp/namespacegpudb#a4c679573328605dc89476ea85fbe6e87">true</a>, then the output table specified in <span className="em arg">tableName</span> will be persisted and will not expire unless a <a className="el" href="/content/api/cpp/namespacegpudb#ae26c0d26d90ab3efc46df04a3b6f5d82">ttl</a> is specified. If <a className="el" href="/content/api/cpp/namespacegpudb#a3196fd11fabb927d36a20e258903b566">false</a>, then the output table will be an in-memory table and will expire unless a <a className="el" href="/content/api/cpp/namespacegpudb#ae26c0d26d90ab3efc46df04a3b6f5d82">ttl</a> is specified otherwise. Supported values:

                    <ul>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#a4c679573328605dc89476ea85fbe6e87">create\_union\_true</a> </li>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#a3196fd11fabb927d36a20e258903b566">create\_union\_false</a> </li>
                    </ul>

                    The default value is <a className="el" href="/content/api/cpp/namespacegpudb#a3196fd11fabb927d36a20e258903b566">create\_union\_false</a>.
                  </li>

                  <li> <a className="el" href="/content/api/cpp/namespacegpudb#a121d9344dd13b32115aae87091b60719">create\_union\_view\_id</a>: ID of view of which this output table is a member. The default value is ''. </li>

                  <li>
                    <a className="el" href="/content/api/cpp/namespacegpudb#a44773403e73d309d0a9ce8584d7f8ed0">create\_union\_force\_replicated</a>: If <a className="el" href="/content/api/cpp/namespacegpudb#a4c679573328605dc89476ea85fbe6e87">true</a>, then the output table specified in <span className="em arg">tableName</span> will be replicated even if the source tables are not. Supported values:

                    <ul>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#a4c679573328605dc89476ea85fbe6e87">create\_union\_true</a> </li>
                      <li> <a className="el" href="/content/api/cpp/namespacegpudb#a3196fd11fabb927d36a20e258903b566">create\_union\_false</a> </li>
                    </ul>

                    The default value is <a className="el" href="/content/api/cpp/namespacegpudb#a3196fd11fabb927d36a20e258903b566">create\_union\_false</a>.
                  </li>

                  <li> <a className="el" href="/content/api/cpp/namespacegpudb#ac00533b09c4716e5648374f898a6d14f">create\_union\_strategy\_definition</a>: The <a href="/content/rm/concepts/#tier-strategies" target="_top">tier strategy</a> for the table and its columns. </li>
                  <li> <a className="el" href="/content/api/cpp/namespacegpudb#aeeae3d1a145f68adb1aca9d363af98ae">create\_union\_compression\_codec</a>: The default <a href="/content/concepts/column_compression/" target="_top">compression codec</a> for this table's columns. </li>
                  <li> <a className="el" href="/content/api/cpp/namespacegpudb#add05709137466e254cb09aa39e9655bd">create\_union\_no\_count</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 map.
              </td>
            </tr>

            <tr>
              <td className="paramdir">\[out]</td>
              <td className="paramname">response\_</td>
              <td><a className="el" href="/content/api/cpp/structgpudb_1_1CreateUnionResponse">Response</a> object containing the results of the operation.</td>
            </tr>
          </table>
        </div>
      </div>

      <div className="dl section return">
        <div className="dt">Returns</div>
        <div className="dd"><a className="el" href="/content/api/cpp/structgpudb_1_1CreateUnionResponse">Response</a> object containing the result of the operation (initially passed in by reference). </div>
      </div>
    </div>
  </div>
</div>
