[TOC] # DROP TABLE ## 描述 该语句用于删除 OceanBase 数据库中的表。 ## 格式 ~~~ DROP [TEMPORARY] {TABLE | TABLES} [IF EXISTS] table_name [,table_name]... [RESTRICT | CASCADE] ~~~ ## 参数解释 <table data-tag="table" id="table-0v7-5i2-n2k" class="table"><colgroup width="360" span="1" data-tag="col" id="col-jmk-yzp-i01" colwidth="1*" colnum="1" colname="col1" style="width:50%" class="col"></colgroup><colgroup width="360" span="1" data-tag="col" id="col-g8w-tri-8x5" colwidth="1*" colnum="2" colname="col2" style="width:50%" class="col"></colgroup><thead id="thead-vxw-okp-k28" class="thead"><tr id="tr-39n-5ti-ipv"><th id="td-uwn-v33-ohx"><p id="p-c26-w6y-9wx"><b>参数</b></p></th><th id="td-1kx-z05-mkr"><p id="p-doh-hja-fam"><b>描述</b></p></th></tr></thead><tbody data-tag="tbody" id="tbody-b2t-639-zez" class="tbody"><tr data-tag="tr" id="tr-o40-i2c-1hn" class="tr"><td data-tag="td" id="td-1pi-pn8-oae" class="td"><p id="p-b1a-og3-iqr">table_name</p></td><td data-tag="td" id="td-ogr-f89-g6d" class="td"><p data-tag="p" id="p-s6u-8zr-jbm" class="p">指定要删除的表名,同时删除多个表时,用“,”隔开。</p></td></tr><tr data-tag="tr" id="tr-acx-y3y-cwd" class="tr"><td data-tag="td" id="td-im4-5zb-peu" class="td"><p id="p-8o4-8wi-ndk">IF EXISTS</p></td><td data-tag="td" id="td-dto-pvi-jy5" class="td"><p data-tag="p" id="p-s97-bg2-9dn" class="p">如果指定IF EXISTS,即使要删除的表不存在,也不会报错;如果不指定,则会报错。</p></td></tr><tr data-tag="tr" id="tr-nsr-7r2-piz" class="tr"><td data-tag="td" id="td-uqd-ygf-hod" class="td"><p id="p-yhf-fnk-6yf">TEMPORARY</p></td><td data-tag="td" id="td-n7g-nmf-4dp" class="td"><p data-tag="p" id="p-90n-how-b0g" class="p">删除临时表。</p></td></tr><tr data-tag="tr" id="tr-5r1-t4y-ca8" class="tr"><td data-tag="td" id="td-vbg-ean-t5o" class="td"><p id="p-v1a-6dg-t2v">RESTRICT | CASCADE</p></td><td data-tag="td" id="td-rhu-cgu-n8y" class="td"><p data-tag="p" id="p-w4u-eky-lb3" class="p">用于其它数据库迁移至OceanBase的场景。</p></td></tr></tbody></table> ## 示例 * 删除表 test ~~~ DROP TABLE IF EXISTS test; ~~~