Yang, Tong 6182f91ba8 MRS component operation guide_normal 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>
2022-12-09 14:55:21 +00:00

48 lines
4.8 KiB
HTML

<a name="mrs_01_1430"></a><a name="mrs_01_1430"></a>
<h1 class="topictitle1">TABLE RENAME</h1>
<div id="body1595920211473"><div class="section" id="mrs_01_1430__s7b11660f852643e4aea864de4998005c"><h4 class="sectiontitle">Function</h4><p id="mrs_01_1430__a888e3ae84b374510bb693e3ac4a99e65">This command is used to rename an existing table.</p>
</div>
<div class="section" id="mrs_01_1430__s2c3f60acb93b4356ac5bc67abfff07d4"><h4 class="sectiontitle">Syntax</h4><p id="mrs_01_1430__af55fd62a83a348cebfdbd02362bd4349"><b><span class="cmdname" id="mrs_01_1430__cmdname1662619212139">ALTER TABLE</span></b> <i><span class="varname" id="mrs_01_1430__vdd0a92613851481b81facbee550e2d35">[db_name.]table_name</span></i> <b><span class="cmdname" id="mrs_01_1430__cmdname147611459275">RENAME TO</span></b> <i><span class="varname" id="mrs_01_1430__v3666be9470fd4049886c488afc1a8826">new_table_name</span></i>;</p>
</div>
<div class="section" id="mrs_01_1430__sdc0323c750764d6f96d43319912b8366"><h4 class="sectiontitle">Parameter Description</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="mrs_01_1430__ta7db20ab0a0f433281cbbaa17fa10298" frame="border" border="1" rules="all"><caption><b>Table 1 </b>RENAME parameters</caption><thead align="left"><tr id="mrs_01_1430__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__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__a8d01c89092cd4e1c9715ef2f7175411a">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="mrs_01_1430__rc834ec772a4b4cf7a86e07e109b677f2"><td class="cellrowborder" valign="top" width="22.45%" headers="mcps1.3.3.2.2.3.1.1 "><p id="mrs_01_1430__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__abe62ac583eb84a4090a9fc8223fa7411">Database name. If this parameter is not specified, the current database is selected.</p>
</td>
</tr>
<tr id="mrs_01_1430__rf6c9315194b945d6b550d071d92c8ebd"><td class="cellrowborder" valign="top" width="22.45%" headers="mcps1.3.3.2.2.3.1.1 "><p id="mrs_01_1430__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__a3fea95dbbcb0488492de620a57117419">Current name of the existing table</p>
</td>
</tr>
<tr id="mrs_01_1430__r643ecc765c5341c0bdf0b7018c6f469a"><td class="cellrowborder" valign="top" width="22.45%" headers="mcps1.3.3.2.2.3.1.1 "><p id="mrs_01_1430__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__a4073487e45db420f8d81f417625213bb">New name of the existing table</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="mrs_01_1430__s86c7e792f3f84be0874b3cd6dfac9337"><h4 class="sectiontitle">Precautions</h4><ul id="mrs_01_1430__u484dc67ce27444228eb25e52796160fc"><li id="mrs_01_1430__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__l4b02f6e829884d468fd4ab0cc4b26a2b">The secondary index table cannot be renamed.</li></ul>
</div>
<div class="section" id="mrs_01_1430__s9ad0c997bd244f47b9f878599f356f6c"><h4 class="sectiontitle">Example</h4><p id="mrs_01_1430__a9810ffe75c194e30bf7b7cf73ad13d4d"><b><span class="cmdname" id="mrs_01_1430__cmdname10690670131">ALTER TABLE</span></b> <i><span class="varname" id="mrs_01_1430__v5e0aec7bcd204d8589a9fe1d958e619a">carbon</span></i> <b><span class="cmdname" id="mrs_01_1430__cmdname1915581181317">RENAME TO</span></b> <i><span class="varname" id="mrs_01_1430__vf4227d32c0e94c1ab11a5e0f514ce405">carbondata</span></i>;</p>
<p id="mrs_01_1430__aaa83be497de44aaba7b3418082ce8fa0"><b><span class="cmdname" id="mrs_01_1430__cmdname07821514191314">ALTER TABLE</span></b> <i><span class="varname" id="mrs_01_1430__v967148d80f7e49d0b58abff4a9f745e7">test_db.carbon</span></i> <b><span class="cmdname" id="mrs_01_1430__cmdname1480619206137">RENAME TO</span></b> <i><span class="varname" id="mrs_01_1430__vbb913b9a896b48049e003e068bb7de1b">test_db.carbondata</span></i>;</p>
</div>
<div class="section" id="mrs_01_1430__scf320ce38a6a4f94918d119806d95fe1"><h4 class="sectiontitle">System Response</h4><p id="mrs_01_1430__a267e6e3b3fb6490683573e752aa4c6c3">The new table name will be displayed in the CarbonData folder. You can run <strong id="mrs_01_1430__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>