forked from docs/doc-exports
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com> Co-authored-by: Lu, Huayi <luhuayi@huawei.com> Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
36 lines
5.9 KiB
HTML
36 lines
5.9 KiB
HTML
<a name="EN-US_TOPIC_0000001098990682"></a><a name="EN-US_TOPIC_0000001098990682"></a>
|
|
|
|
<h1 class="topictitle1">DROP TABLE</h1>
|
|
<div id="body8662426"><div class="section" id="EN-US_TOPIC_0000001098990682__s04633346cf72456db074e61b993fa111"><h4 class="sectiontitle">Function</h4><p id="EN-US_TOPIC_0000001098990682__ab4165269429f4f0bb6373d4e25c9a243"><strong id="EN-US_TOPIC_0000001098990682__b461094329394">DROP TABLE</strong> deletes a specified table.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001098990682__s30443e07b9934ae886f7a218b92b8d6e"><h4 class="sectiontitle">Precautions</h4><ul id="EN-US_TOPIC_0000001098990682__ul11297156166"><li id="EN-US_TOPIC_0000001098990682__li4754134232111">Only the table owner, schema owner, and system administrator have the permission to delete a table. To delete all the rows in a table but retain the table definition, use <strong id="EN-US_TOPIC_0000001098990682__b19210204012533">TRUNCATE</strong> or <strong id="EN-US_TOPIC_0000001098990682__b448915414535">DELETE</strong>.</li><li id="EN-US_TOPIC_0000001098990682__li193912161779"><strong id="EN-US_TOPIC_0000001098990682__b1988284314532">DROP TABLE</strong> forcibly deletes a specified table. After a table is deleted, any indexes that exist for the table will be deleted; any functions or stored procedures that use this table cannot be run. Deleting a partitioned table also deletes all partitions in the table.</li></ul>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001098990682__s75899e6bac48419885f6deeaa11a13bf"><h4 class="sectiontitle">Syntax</h4><div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001098990682__s1e8b545cb6894f7e8496416bb64b07c5"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
|
|
<span class="normal">2</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">DROP</span><span class="w"> </span><span class="k">TABLE</span><span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="k">IF</span><span class="w"> </span><span class="k">EXISTS</span><span class="w"> </span><span class="p">]</span><span class="w"> </span>
|
|
<span class="w"> </span><span class="err">{</span><span class="w"> </span><span class="p">[</span><span class="k">schema</span><span class="p">.]</span><span class="k">table_name</span><span class="w"> </span><span class="err">}</span><span class="w"> </span><span class="p">[,</span><span class="w"> </span><span class="p">...]</span><span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="k">CASCADE</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">RESTRICT</span><span class="w"> </span><span class="p">];</span><span class="w"></span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001098990682__s6e75d841c4ee49bda8ae5f2783d347e3"><h4 class="sectiontitle">Parameter Description</h4><ul id="EN-US_TOPIC_0000001098990682__u3ca9d6cc3d564718bbd87186cf69ec15"><li id="EN-US_TOPIC_0000001098990682__l3568ac8a50794739a7766b4110864c55"><strong id="EN-US_TOPIC_0000001098990682__ad1fa59e549fb47b4b81a5f5733a9516d">IF EXISTS</strong><p id="EN-US_TOPIC_0000001098990682__a8641d5a28c2c477e952015c6e041e7cc">Sends a notice instead of an error if the specified table does not exist.</p>
|
|
</li><li id="EN-US_TOPIC_0000001098990682__l92219c9c05f24f8eb04775c02ef21085"><strong id="EN-US_TOPIC_0000001098990682__aa85b55aa38524776bd9fe61c99188bf5">schema</strong><p id="EN-US_TOPIC_0000001098990682__a29e67b8a6e894b21b3e52a3e5841b844">Specifies the schema name.</p>
|
|
</li><li id="EN-US_TOPIC_0000001098990682__l60c4c96892784f729249d114f1fa5808"><strong id="EN-US_TOPIC_0000001098990682__af37618ba12b542bd8bb42f2d4546a57e">table_name</strong><p id="EN-US_TOPIC_0000001098990682__a03953ad2ba284c83a845a2d7bec34352">Specifies the name of the table.</p>
|
|
</li><li id="EN-US_TOPIC_0000001098990682__l7aa1ae30df5e44a6b54502eb98347c59"><strong id="EN-US_TOPIC_0000001098990682__a95371b22572f432ba5d5ad52493dbba0">CASCADE | RESTRICT</strong><ul id="EN-US_TOPIC_0000001098990682__ub6ff53fcc6bd46e2afc8dbb19728e2c2"><li id="EN-US_TOPIC_0000001098990682__l3ac67876cd694b03819e44bc860af15b"><strong id="EN-US_TOPIC_0000001098990682__en-us_topic_0058965805_b842352706195927">CASCADE</strong>: automatically deletes objects (such as views) that depend on the table to be deleted.</li><li id="EN-US_TOPIC_0000001098990682__l653944b58bb34bc4822f083f611eb981"><strong id="EN-US_TOPIC_0000001098990682__en-us_topic_0058965805_b842352706101857">RESTRICT</strong> (default): refuses to delete the table if any objects depend on it. This is the default.</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001098990682__s637909d8772b49a6a931a80f9b96c4b3"><h4 class="sectiontitle">Example</h4><p id="EN-US_TOPIC_0000001098990682__p1811511841420">Delete the <strong id="EN-US_TOPIC_0000001098990682__b1443293953817">warehouse_t1</strong> table.</p>
|
|
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001098990682__screen107382102912"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">DROP</span><span class="w"> </span><span class="k">TABLE</span><span class="w"> </span><span class="n">tpcds</span><span class="p">.</span><span class="n">warehouse_t1</span><span class="p">;</span><span class="w"></span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001098990682__s027896f3fed6449595011f915ba6ea23"><h4 class="sectiontitle">Links</h4><p id="EN-US_TOPIC_0000001098990682__a663c6981f3ef4d208bff844de1c173ff"><a href="dws_06_0142.html">ALTER TABLE</a>, <a href="dws_06_0177.html">CREATE TABLE</a></p>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_06_0118.html">DDL Syntax</a></div>
|
|
</div>
|
|
</div>
|
|
|