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

23 lines
3.6 KiB
HTML

<a name="mrs_01_1410"></a><a name="mrs_01_1410"></a>
<h1 class="topictitle1">Deleting a CarbonData Table</h1>
<div id="body8662426"><div class="section" id="mrs_01_1410__en-us_topic_0000001173789324_s5beaf4b5857a4dfa9320d921d901a1d8"><h4 class="sectiontitle">Scenario</h4><p id="mrs_01_1410__en-us_topic_0000001173789324_adea69965f1944e6ea2c963c107c76b34">You can run the <b><span class="cmdname" id="mrs_01_1410__en-us_topic_0000001173789324_cmdname2025335415">DROP TABLE</span></b> command to delete a table. After a CarbonData table is deleted, its metadata and loaded data are deleted together.</p>
</div>
<div class="section" id="mrs_01_1410__en-us_topic_0000001173789324_s78854abcf29444c6863279bc2b4e039f"><h4 class="sectiontitle">Procedure</h4><p id="mrs_01_1410__en-us_topic_0000001173789324_a2f2e3377a30d4b34ba67fa7fd8aff474">Run the following command to delete a CarbonData table:</p>
<p id="mrs_01_1410__en-us_topic_0000001173789324_a0a3b15f32c464b56a74391700c1d261b">Run the following command:</p>
<p id="mrs_01_1410__en-us_topic_0000001173789324_a7c433abf5ff94d248752aece4c638c3d"><b><span class="cmdname" id="mrs_01_1410__en-us_topic_0000001173789324_cmdname95839360417">DROP TABLE</span></b> <i><span class="varname" id="mrs_01_1410__en-us_topic_0000001173789324_v566765b1daf240178f40af775f83c582">[IF EXISTS] [db_name.]table_name;</span></i></p>
<p id="mrs_01_1410__en-us_topic_0000001173789324_a39adfc55eecc4a51a008deb1335dc767">Once this command is executed, the table is deleted from the system. In the command, <span class="parmname" id="mrs_01_1410__en-us_topic_0000001173789324_p23f37e8aee0e4db5b6091755b1908728"><b>db_name</b></span> is an optional parameter. If <span class="parmname" id="mrs_01_1410__en-us_topic_0000001173789324_pf5287e58060348e7b18808b5da36e708"><b>db_name</b></span> is not specified, the table named <span class="parmname" id="mrs_01_1410__en-us_topic_0000001173789324_p71f1e00d1e4c4e9caa64cd826b4fe67d"><b>table_name</b></span> in the current database is deleted.</p>
<p id="mrs_01_1410__en-us_topic_0000001173789324_a7aedc8eb95004748816e144e997fa6c1">Example:</p>
<p id="mrs_01_1410__en-us_topic_0000001173789324_a4e21ed02902a43f78edc91b2ccff1d90"><b><span class="cmdname" id="mrs_01_1410__en-us_topic_0000001173789324_cmdname369724654113">DROP TABLE</span></b> <i><span class="varname" id="mrs_01_1410__en-us_topic_0000001173789324_v3d6dcc7dafce4fe383c8d34c1b9c3a96">productdb.productSalesTable;</span></i></p>
<p id="mrs_01_1410__en-us_topic_0000001173789324_a903d9a6596ce4dae8d197fba725bbf70">Run the preceding command to delete the <span class="parmvalue" id="mrs_01_1410__en-us_topic_0000001173789324_ped3c42c4f4834edd89b05c6a5f433d7f"><b>productSalesTable</b></span> table from the <span class="parmvalue" id="mrs_01_1410__en-us_topic_0000001173789324_paa744d600ebf401ab3333baa0d6d4358"><b>productdb</b></span> database.</p>
</div>
<div class="section" id="mrs_01_1410__en-us_topic_0000001173789324_sd0fc9e8e8aaa4c8498322cab6950fb82"><h4 class="sectiontitle">Operation Result</h4><p id="mrs_01_1410__en-us_topic_0000001173789324_acd342a2d541748bb85818f4abaf15557">Deletes the table specified in the command from the system. After the table is deleted, you can run the <b><span class="cmdname" id="mrs_01_1410__en-us_topic_0000001173789324_cmdname014945415418">SHOW TABLES</span></b> command to check whether the table is successfully deleted. For details, see <a href="mrs_01_1428.html">SHOW TABLES</a>.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="mrs_01_1407.html">CarbonData Table Management</a></div>
</div>
</div>