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>
55 lines
5.4 KiB
HTML
55 lines
5.4 KiB
HTML
<a name="dli_spark_min"></a><a name="dli_spark_min"></a>
|
|
|
|
<h1 class="topictitle1">min</h1>
|
|
<div id="body8662426"><p id="dli_spark_min__en-us_topic_0000001703740641_p18471163815215">This function is used to return the minimum value.</p>
|
|
<div class="section" id="dli_spark_min__en-us_topic_0000001703740641_section45291954203217"><h4 class="sectiontitle">Syntax</h4><pre class="screen" id="dli_spark_min__en-us_topic_0000001703740641_screen19928459112517">min(col)</pre>
|
|
</div>
|
|
<div class="section" id="dli_spark_min__en-us_topic_0000001703740641_section992014913317"><h4 class="sectiontitle">Parameters</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_spark_min__en-us_topic_0000001703740641_table1829154762513" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameter</caption><thead align="left"><tr id="dli_spark_min__en-us_topic_0000001703740641_row8830104792517"><th align="left" class="cellrowborder" valign="top" width="13.930000000000001%" id="mcps1.3.3.2.2.5.1.1"><p id="dli_spark_min__en-us_topic_0000001703740641_p983074711252">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="13.77%" id="mcps1.3.3.2.2.5.1.2"><p id="dli_spark_min__en-us_topic_0000001703740641_p6830124732517">Mandatory</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="15.590000000000002%" id="mcps1.3.3.2.2.5.1.3"><p id="dli_spark_min__en-us_topic_0000001703740641_p3544855878">Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="56.71000000000001%" id="mcps1.3.3.2.2.5.1.4"><p id="dli_spark_min__en-us_topic_0000001703740641_p08301547132513">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_spark_min__en-us_topic_0000001703740641_row15830184792511"><td class="cellrowborder" valign="top" width="13.930000000000001%" headers="mcps1.3.3.2.2.5.1.1 "><p id="dli_spark_min__en-us_topic_0000001703740641_p683034714250">col</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.77%" headers="mcps1.3.3.2.2.5.1.2 "><p id="dli_spark_min__en-us_topic_0000001703740641_p12830184752518">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="15.590000000000002%" headers="mcps1.3.3.2.2.5.1.3 "><p id="dli_spark_min__en-us_topic_0000001703740641_p12545115517713">Any type except BOOLEAN</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.71000000000001%" headers="mcps1.3.3.2.2.5.1.4 "><p id="dli_spark_min__en-us_topic_0000001703740641_p9484232112711">The value can be of any type except BOOLEAN.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="dli_spark_min__en-us_topic_0000001703740641_section210162513312"><h4 class="sectiontitle">Return Values</h4><p id="dli_spark_min__en-us_topic_0000001703740641_p184124317231">The return value is of the DOUBLE type.</p>
|
|
<div class="note" id="dli_spark_min__en-us_topic_0000001703740641_note61422099395"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="dli_spark_min__en-us_topic_0000001703740641_p18336361368">The return type is the same as the type of <strong id="dli_spark_min__en-us_topic_0000001703740641_b16531382223383">col</strong>. The return rules are as follows:</p>
|
|
<ul id="dli_spark_min__en-us_topic_0000001703740641_ul632918526616"><li id="dli_spark_min__en-us_topic_0000001703740641_li173299521563">If the value of <strong id="dli_spark_min__en-us_topic_0000001703740641_b207859841233819">col</strong> is <strong id="dli_spark_min__en-us_topic_0000001703740641_b51571658933819">NULL</strong>, the row is not involved in calculation.</li><li id="dli_spark_min__en-us_topic_0000001703740641_li1032918523616">If the value of <strong id="dli_spark_min__en-us_topic_0000001703740641_b84102825633841">col</strong> is of the BOOLEAN type, it cannot be used for calculation.</li></ul>
|
|
</div></div>
|
|
</div>
|
|
<div class="section" id="dli_spark_min__en-us_topic_0000001703740641_section13277192233920"><h4 class="sectiontitle">Example Code</h4><ul id="dli_spark_min__en-us_topic_0000001703740641_ul83641559143615"><li id="dli_spark_min__en-us_topic_0000001703740641_li436418597362">Calculates the minimum inventory (items) of all offerings. An example command is as follows:<pre class="screen" id="dli_spark_min__en-us_topic_0000001703740641_screen167071724182119">select min(items) from warehouse;</pre>
|
|
<p id="dli_spark_min__en-us_topic_0000001703740641_p1479623217474">The command output is as follows:</p>
|
|
<pre class="screen" id="dli_spark_min__en-us_topic_0000001703740641_screen1349103932113">_c0
|
|
600 </pre>
|
|
</li><li id="dli_spark_min__en-us_topic_0000001703740641_li183161387378">When used with <strong id="dli_spark_min__en-us_topic_0000001703740641_b1543582014407">group by</strong>, it returns the minimum inventory of each warehouse. An example command is as follows:<pre class="screen" id="dli_spark_min__en-us_topic_0000001703740641_screen20914756112116">select warehourseId, min(items) from warehouse group by warehourseId;</pre>
|
|
<p id="dli_spark_min__en-us_topic_0000001703740641_p4923632154714">The command output is as follows:</p>
|
|
<pre class="screen" id="dli_spark_min__en-us_topic_0000001703740641_screen14988112152718">warehouseId _c1
|
|
city1 15
|
|
city2 10
|
|
city3 19 </pre>
|
|
</li></ul>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dli_08_0474.html">Aggregate Functions</a></div>
|
|
</div>
|
|
</div>
|
|
|