doc-exports/docs/dli/sqlreference/dli_08_0094.html
Su, Xiaomeng 76a5b1ee83 dli_sqlreference_20240227
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>
2024-03-27 22:02:33 +00:00

60 lines
7.7 KiB
HTML

<a name="dli_08_0094"></a><a name="dli_08_0094"></a>
<h1 class="topictitle1">Viewing All Partitions in a Specified Table</h1>
<div id="body8662426"><div class="section" id="dli_08_0094__en-us_topic_0114776188_en-us_topic_0093946905_s74a9b1f337c249389fcb46e2ad9d098b"><h4 class="sectiontitle">Function</h4><p id="dli_08_0094__en-us_topic_0114776188_en-us_topic_0093946905_a94696cca65424e31b6baa5c3a34c108d">This statement is used to view all partitions in a specified table.</p>
</div>
<div class="section" id="dli_08_0094__en-us_topic_0114776188_en-us_topic_0093946905_sb9a84b1df0fa40c198d995131e29b6a3"><h4 class="sectiontitle">Syntax</h4><div class="codecoloring" codetype="Sql" id="dli_08_0094__en-us_topic_0114776188_screen7131310422"><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">SHOW</span><span class="w"> </span><span class="n">PARTITIONS</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="w"> </span><span class="p">[</span><span class="n">PARTITION</span><span class="w"> </span><span class="n">partition_specs</span><span class="p">];</span>
</pre></div></td></tr></table></div>
</div>
</div>
<div class="section" id="dli_08_0094__en-us_topic_0114776187_en-us_topic_0093946896_s9efebf7e28f54c3b9f13e799dfc94846"><h4 class="sectiontitle">Keywords</h4><ul id="dli_08_0094__ul25611253182612"><li id="dli_08_0094__li20561105322612">PARTITIONS: partitions in a specified table</li><li id="dli_08_0094__li956115392613">PARTITION: a specified partition</li></ul>
</div>
<div class="section" id="dli_08_0094__en-us_topic_0114776188_en-us_topic_0093946905_s95436b2cebbc4c34b0e6ca8427d4f1d9"><h4 class="sectiontitle">Parameters</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_0094__en-us_topic_0114776188_en-us_topic_0103084433_t2fa8597e0dde4884bd6412ac207ebea8" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameters</caption><thead align="left"><tr id="dli_08_0094__en-us_topic_0114776188_en-us_topic_0103084433_r16c75fd8fdbf41c79f9aee82b032351c"><th align="left" class="cellrowborder" valign="top" width="18.990000000000002%" id="mcps1.3.4.2.2.3.1.1"><p id="dli_08_0094__en-us_topic_0114776188_en-us_topic_0103084433_a9dd69379a3f54904a9c510fb817659ad"><strong id="dli_08_0094__b988552515312">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="81.01%" id="mcps1.3.4.2.2.3.1.2"><p id="dli_08_0094__en-us_topic_0114776188_en-us_topic_0103084433_a7ede0d62539542baa7e367cf902bf2b2"><strong id="dli_08_0094__en-us_topic_0093946771_en-us_topic_0053447306_en-us_topic_0039551470_b6335010717346">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="dli_08_0094__en-us_topic_0114776188_en-us_topic_0103084433_r8ab7399810eb42b7abf51ae705c6cf83"><td class="cellrowborder" valign="top" width="18.990000000000002%" headers="mcps1.3.4.2.2.3.1.1 "><p id="dli_08_0094__en-us_topic_0114776188_en-us_topic_0103084433_a1cdeda4790a8452d8619c797147bf9cf">db_name</p>
</td>
<td class="cellrowborder" valign="top" width="81.01%" headers="mcps1.3.4.2.2.3.1.2 "><p id="dli_08_0094__en-us_topic_0114776188_en-us_topic_0103084433_p4729195274115">Database name that contains letters, digits, and underscores (_). It cannot contain only digits and cannot start with an underscore (_).</p>
</td>
</tr>
<tr id="dli_08_0094__en-us_topic_0114776188_en-us_topic_0103084433_r36540eab62c64ec4babb57549d5776e7"><td class="cellrowborder" valign="top" width="18.990000000000002%" headers="mcps1.3.4.2.2.3.1.1 "><p id="dli_08_0094__en-us_topic_0114776188_en-us_topic_0103084433_aa0912c807a254106a3a033e8ccb9e95e">table_name</p>
</td>
<td class="cellrowborder" valign="top" width="81.01%" headers="mcps1.3.4.2.2.3.1.2 "><p id="dli_08_0094__en-us_topic_0114776188_en-us_topic_0103084433_ae05b93123b5b41ff91b2875680e77dac">Table name of a database that contains letters, digits, and underscores (_). It cannot contain only digits and cannot start with an underscore (_). The matching rule is <strong id="dli_08_0094__b15576041194920">^(?!_)(?![0-9]+$)[A-Za-z0-9_$]*$</strong>. If special characters are required, use single quotation marks ('') to enclose them.</p>
</td>
</tr>
<tr id="dli_08_0094__en-us_topic_0114776188_row1242218202031"><td class="cellrowborder" valign="top" width="18.990000000000002%" headers="mcps1.3.4.2.2.3.1.1 "><p id="dli_08_0094__en-us_topic_0114776188_en-us_topic_0103084434_p4561757995919">partition_specs</p>
</td>
<td class="cellrowborder" valign="top" width="81.01%" headers="mcps1.3.4.2.2.3.1.2 "><p id="dli_08_0094__en-us_topic_0114776188_en-us_topic_0103084434_p3787647395919">Partition information, in the format of "key=value", where <strong id="dli_08_0094__b20734163583116">key</strong> indicates the partition field and <strong id="dli_08_0094__b1873553593117">value</strong> indicates the partition value. If a partition field contains multiple fields, the system displays all partition information that matches the partition field.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="dli_08_0094__en-us_topic_0114776188_en-us_topic_0093946905_sb82d7f5387534c00883125b665b71bf7"><h4 class="sectiontitle">Precautions</h4><p id="dli_08_0094__en-us_topic_0114776188_en-us_topic_0093946905_a7e06d52fc8ad44008defd02ad1c5aac5">The table specified in this statement must exist and must be a partitioned table. Otherwise, an error is reported.</p>
</div>
<div class="section" id="dli_08_0094__en-us_topic_0114776188_en-us_topic_0093946905_sa0146c98342647c5be134eaf4064b3f4"><h4 class="sectiontitle">Example</h4><ul id="dli_08_0094__en-us_topic_0114776188_en-us_topic_0093946905_ul15382280152833"><li id="dli_08_0094__en-us_topic_0114776188_en-us_topic_0093946905_li55873288152833">To show all partitions in the <strong id="dli_08_0094__en-us_topic_0107972090_en-us_topic_0093946905_b842352706162034">student</strong> table, run the following statement:<div class="codecoloring" codetype="Sql" id="dli_08_0094__en-us_topic_0114776188_screen074616162414"><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">SHOW</span><span class="w"> </span><span class="n">PARTITIONS</span><span class="w"> </span><span class="n">student</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
</li><li id="dli_08_0094__en-us_topic_0114776188_en-us_topic_0093946905_li42775436152833">Check the <strong id="dli_08_0094__en-us_topic_0107972090_en-us_topic_0093946905_b842352706162048">dt='2010-10-10'</strong> partition in the <strong id="dli_08_0094__en-us_topic_0107972090_en-us_topic_0093946905_b842352706162056">student</strong> table, run the following statement:<div class="codecoloring" codetype="Sql" id="dli_08_0094__en-us_topic_0114776188_screen1037853513413"><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">SHOW</span><span class="w"> </span><span class="n">PARTITIONS</span><span class="w"> </span><span class="n">student</span><span class="w"> </span><span class="n">PARTITION</span><span class="p">(</span><span class="n">dt</span><span class="o">=</span><span class="s1">'2010-10-10'</span><span class="p">)</span>
</pre></div></td></tr></table></div>
</div>
</li></ul>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dli_08_0089.html">Viewing Tables</a></div>
</div>
</div>