Yang, Tong 3f5759eed2 MRS comp-lts 2.0.38.SP20 version
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
Co-authored-by: Yang, Tong <yangtong2@huawei.com>
Co-committed-by: Yang, Tong <yangtong2@huawei.com>
2023-01-19 17:08:45 +00:00

48 lines
6.0 KiB
HTML

<a name="mrs_01_1430"></a><a name="mrs_01_1430"></a>
<h1 class="topictitle1">TABLE RENAME</h1>
<div id="body8662426"><div class="section" id="mrs_01_1430__en-us_topic_0000001173789334_s7b11660f852643e4aea864de4998005c"><h4 class="sectiontitle">Function</h4><p id="mrs_01_1430__en-us_topic_0000001173789334_a888e3ae84b374510bb693e3ac4a99e65">This command is used to rename an existing table.</p>
</div>
<div class="section" id="mrs_01_1430__en-us_topic_0000001173789334_s2c3f60acb93b4356ac5bc67abfff07d4"><h4 class="sectiontitle">Syntax</h4><p id="mrs_01_1430__en-us_topic_0000001173789334_af55fd62a83a348cebfdbd02362bd4349"><b><span class="cmdname" id="mrs_01_1430__en-us_topic_0000001173789334_cmdname1662619212139">ALTER TABLE</span></b> <i><span class="varname" id="mrs_01_1430__en-us_topic_0000001173789334_vdd0a92613851481b81facbee550e2d35">[db_name.]table_name</span></i> <b><span class="cmdname" id="mrs_01_1430__en-us_topic_0000001173789334_cmdname147611459275">RENAME TO</span></b> <i><span class="varname" id="mrs_01_1430__en-us_topic_0000001173789334_v3666be9470fd4049886c488afc1a8826">new_table_name</span></i>;</p>
</div>
<div class="section" id="mrs_01_1430__en-us_topic_0000001173789334_sdc0323c750764d6f96d43319912b8366"><h4 class="sectiontitle">Parameter Description</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="mrs_01_1430__en-us_topic_0000001173789334_ta7db20ab0a0f433281cbbaa17fa10298" frame="border" border="1" rules="all"><caption><b>Table 1 </b>RENAME parameters</caption><thead align="left"><tr id="mrs_01_1430__en-us_topic_0000001173789334_rf04e12d959bc4a21aaf9613b9a8b86a7"><th align="left" class="cellrowborder" valign="top" width="22.45%" id="mcps1.3.3.2.2.3.1.1"><p id="mrs_01_1430__en-us_topic_0000001173789334_a0c6c715fc61345639fcd0562447b4788">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="77.55%" id="mcps1.3.3.2.2.3.1.2"><p id="mrs_01_1430__en-us_topic_0000001173789334_a8d01c89092cd4e1c9715ef2f7175411a">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="mrs_01_1430__en-us_topic_0000001173789334_rc834ec772a4b4cf7a86e07e109b677f2"><td class="cellrowborder" valign="top" width="22.45%" headers="mcps1.3.3.2.2.3.1.1 "><p id="mrs_01_1430__en-us_topic_0000001173789334_a91a5840c84f849ec98da5dfb14cc5347">db_name</p>
</td>
<td class="cellrowborder" valign="top" width="77.55%" headers="mcps1.3.3.2.2.3.1.2 "><p id="mrs_01_1430__en-us_topic_0000001173789334_abe62ac583eb84a4090a9fc8223fa7411">Database name. If this parameter is not specified, the current database is selected.</p>
</td>
</tr>
<tr id="mrs_01_1430__en-us_topic_0000001173789334_rf6c9315194b945d6b550d071d92c8ebd"><td class="cellrowborder" valign="top" width="22.45%" headers="mcps1.3.3.2.2.3.1.1 "><p id="mrs_01_1430__en-us_topic_0000001173789334_acaa4dea953054ed4b08b81fc650976f6">table_name</p>
</td>
<td class="cellrowborder" valign="top" width="77.55%" headers="mcps1.3.3.2.2.3.1.2 "><p id="mrs_01_1430__en-us_topic_0000001173789334_a3fea95dbbcb0488492de620a57117419">Current name of the existing table</p>
</td>
</tr>
<tr id="mrs_01_1430__en-us_topic_0000001173789334_r643ecc765c5341c0bdf0b7018c6f469a"><td class="cellrowborder" valign="top" width="22.45%" headers="mcps1.3.3.2.2.3.1.1 "><p id="mrs_01_1430__en-us_topic_0000001173789334_a85a34ddb85c445318c4691995e98a2cd">new_table_name</p>
</td>
<td class="cellrowborder" valign="top" width="77.55%" headers="mcps1.3.3.2.2.3.1.2 "><p id="mrs_01_1430__en-us_topic_0000001173789334_a4073487e45db420f8d81f417625213bb">New name of the existing table</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="mrs_01_1430__en-us_topic_0000001173789334_s86c7e792f3f84be0874b3cd6dfac9337"><h4 class="sectiontitle">Precautions</h4><ul id="mrs_01_1430__en-us_topic_0000001173789334_u484dc67ce27444228eb25e52796160fc"><li id="mrs_01_1430__en-us_topic_0000001173789334_l40eb261ae03b40e1a9ba552c915d41c1">Parallel queries (using table names to obtain paths for reading CarbonData storage files) may fail during this operation.</li><li id="mrs_01_1430__en-us_topic_0000001173789334_l4b02f6e829884d468fd4ab0cc4b26a2b">The secondary index table cannot be renamed.</li></ul>
</div>
<div class="section" id="mrs_01_1430__en-us_topic_0000001173789334_s9ad0c997bd244f47b9f878599f356f6c"><h4 class="sectiontitle">Example</h4><p id="mrs_01_1430__en-us_topic_0000001173789334_a9810ffe75c194e30bf7b7cf73ad13d4d"><b><span class="cmdname" id="mrs_01_1430__en-us_topic_0000001173789334_cmdname10690670131">ALTER TABLE</span></b> <i><span class="varname" id="mrs_01_1430__en-us_topic_0000001173789334_v5e0aec7bcd204d8589a9fe1d958e619a">carbon</span></i> <b><span class="cmdname" id="mrs_01_1430__en-us_topic_0000001173789334_cmdname1915581181317">RENAME TO</span></b> <i><span class="varname" id="mrs_01_1430__en-us_topic_0000001173789334_vf4227d32c0e94c1ab11a5e0f514ce405">carbondata</span></i>;</p>
<p id="mrs_01_1430__en-us_topic_0000001173789334_aaa83be497de44aaba7b3418082ce8fa0"><b><span class="cmdname" id="mrs_01_1430__en-us_topic_0000001173789334_cmdname07821514191314">ALTER TABLE</span></b> <i><span class="varname" id="mrs_01_1430__en-us_topic_0000001173789334_v967148d80f7e49d0b58abff4a9f745e7">test_db.carbon</span></i> <b><span class="cmdname" id="mrs_01_1430__en-us_topic_0000001173789334_cmdname1480619206137">RENAME TO</span></b> <i><span class="varname" id="mrs_01_1430__en-us_topic_0000001173789334_vbb913b9a896b48049e003e068bb7de1b">test_db.carbondata</span></i>;</p>
</div>
<div class="section" id="mrs_01_1430__en-us_topic_0000001173789334_scf320ce38a6a4f94918d119806d95fe1"><h4 class="sectiontitle">System Response</h4><p id="mrs_01_1430__en-us_topic_0000001173789334_a267e6e3b3fb6490683573e752aa4c6c3">The new table name will be displayed in the CarbonData folder. You can run <strong id="mrs_01_1430__en-us_topic_0000001173789334_b85734519536">SHOW TABLES</strong> to view the new table name.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="mrs_01_1424.html">DDL</a></div>
</div>
</div>