forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: Su, Xiaomeng <suxiaomeng1@huawei.com> Co-committed-by: Su, Xiaomeng <suxiaomeng1@huawei.com>
49 lines
5.3 KiB
HTML
49 lines
5.3 KiB
HTML
<a name="dli_08_0087"></a><a name="dli_08_0087"></a>
|
|
|
|
<h1 class="topictitle1">Deleting a Table</h1>
|
|
<div id="body8662426"><div class="section" id="dli_08_0087__en-us_topic_0114776181_en-us_topic_0093946844_sdbce9debfeb34391b3ca06e51ee332f8"><h4 class="sectiontitle">Function</h4><p id="dli_08_0087__en-us_topic_0114776181_en-us_topic_0093946844_a7e4a171d52144f5aa9a549137c0143a9">This statement is used to delete tables.</p>
|
|
</div>
|
|
<div class="section" id="dli_08_0087__en-us_topic_0114776181_en-us_topic_0093946844_s4c704e2d380348dc951d02909e8bdf84"><h4 class="sectiontitle">Syntax</h4><div class="codecoloring" codetype="Sql" id="dli_08_0087__en-us_topic_0114776181_screen251195242114"><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="p">[</span><span class="k">IF</span><span class="w"> </span><span class="k">EXISTS</span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="n">db_name</span><span class="p">.]</span><span class="k">table_name</span><span class="p">;</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="section" id="dli_08_0087__en-us_topic_0114776181_en-us_topic_0093946844_s3b078ae0416f431daedad915861f3ff5"><h4 class="sectiontitle">Keywords</h4><ul id="dli_08_0087__en-us_topic_0114776181_ul811024717599"><li id="dli_08_0087__en-us_topic_0114776181_li161101647175919">If the table is stored in OBS, only the metadata is deleted. The data stored on OBS is not deleted.</li><li id="dli_08_0087__en-us_topic_0114776181_li2050611231306">If the table is stored in DLI, the data and the corresponding metadata are all deleted.</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_0087__en-us_topic_0114776170_section1130610201331"><h4 class="sectiontitle">Parameters</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_0087__en-us_topic_0114776170_table137579239220" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameters</caption><thead align="left"><tr id="dli_08_0087__en-us_topic_0114776170_row17564232219"><th align="left" class="cellrowborder" valign="top" width="14.05%" id="mcps1.3.4.2.2.3.1.1"><p id="dli_08_0087__en-us_topic_0114776170_p3756152318220">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="85.95%" id="mcps1.3.4.2.2.3.1.2"><p id="dli_08_0087__en-us_topic_0114776170_p167561023629">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_0087__en-us_topic_0114776170_row1375611231219"><td class="cellrowborder" valign="top" width="14.05%" headers="mcps1.3.4.2.2.3.1.1 "><p id="dli_08_0087__en-us_topic_0114776170_p107564232216">db_name</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="85.95%" headers="mcps1.3.4.2.2.3.1.2 "><p id="dli_08_0087__en-us_topic_0114776170_p1575614231121">Database name, which consists of letters, digits, and underscores (_). The value cannot contain only digits or start with a digit or underscore (_).</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_0087__en-us_topic_0114776170_row117571623729"><td class="cellrowborder" valign="top" width="14.05%" headers="mcps1.3.4.2.2.3.1.1 "><p id="dli_08_0087__en-us_topic_0114776170_p87577239219">table_name</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="85.95%" headers="mcps1.3.4.2.2.3.1.2 "><p id="dli_08_0087__en-us_topic_0114776170_p675715235211">Table name</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="dli_08_0087__en-us_topic_0114776181_en-us_topic_0093946844_sda8e3ca739ac4a888fced725dd8d8ad9"><h4 class="sectiontitle">Precautions</h4><p id="dli_08_0087__en-us_topic_0114776181_en-us_topic_0093946844_p6527534711544">The to-be-deleted table must exist in the current database. Otherwise, an error is reported. To avoid this error, add <strong id="dli_08_0087__en-us_topic_0107972083_en-us_topic_0093946844_en-us_topic_0047959882_b27862547103314">IF EXISTS</strong> to this statement.</p>
|
|
</div>
|
|
<div class="section" id="dli_08_0087__en-us_topic_0114776181_en-us_topic_0093946844_sffc94d6bdc8a4a6bb495527f25d5934a"><h4 class="sectiontitle">Example</h4><ol id="dli_08_0087__ol1729182716206"><li id="dli_08_0087__li329102719205">Create a table. For details, see <a href="dli_08_0223.html">Creating an OBS Table</a> or <a href="dli_08_0224.html">Creating a DLI Table</a>.</li><li id="dli_08_0087__li05071772217">Run the following statement to delete table <strong id="dli_08_0087__b19110149486">test</strong> from the current database:<div class="codecoloring" codetype="Sql" id="dli_08_0087__en-us_topic_0114776181_screen6513429112218"><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="k">IF</span><span class="w"> </span><span class="k">EXISTS</span><span class="w"> </span><span class="n">test</span><span class="p">;</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</li></ol>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dli_08_0221.html">Spark SQL Syntax Reference</a></div>
|
|
</div>
|
|
</div>
|
|
|