m (Protected "PQL min()" ([edit=sysop] (indefinite) [move=sysop] (indefinite))) |
mNo edit summary |
||
Line 3: | Line 3: | ||
==PQL MIN() Function== |
==PQL MIN() Function== |
||
The MIN() function returns the smallest value of the selected column. |
The MIN() function returns the smallest value of the selected column. |
||
+ | <br/> |
||
− | |||
+ | <br/> |
||
===PQL MIN() Syntax=== |
===PQL MIN() Syntax=== |
||
<syntaxhighlight lang=sql> |
<syntaxhighlight lang=sql> |
||
Line 10: | Line 11: | ||
FROM stable_name |
FROM stable_name |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
+ | <br/> |
||
− | |||
+ | <br/> |
||
===PQL MIN() Example=== |
===PQL MIN() Example=== |
||
Line 64: | Line 66: | ||
|100 |
|100 |
||
|} |
|} |
||
+ | <br/> |
||
− | |||
+ | <br/> |
||
+ | <br/> |
||
+ | <br/> |
||
<table width="100%"> |
<table width="100%"> |
||
<tr> |
<tr> |
||
− | <td align="left">[[PQL_max()]]</td> |
+ | <td align="left">[[PQL_max()|PQL max()]]</td> |
− | <td align="right">[[PQL_sum()]]</td> |
+ | <td align="right">[[PQL_sum()|PQL sum()]]</td> |
</tr> |
</tr> |
||
</table> |
</table> |
||
− | + | [[Category:PQL_Functions|PQL Functions]] |
Latest revision as of 21:23, 3 November 2012
PQL MIN() Function
The MIN() function returns the smallest value of the selected column.
PQL MIN() Syntax
Spike: Please
SELECT MIN(column_name)
FROM stable_name
PQL MIN() Example
We have the following "Orders" stable:
O_Id | OrderDate | OrderPrice | Customer |
---|---|---|---|
1 | 2010/11/12 | 1000 | Pie |
2 | 2010/10/23 | 1600 | Sparkle |
3 | 2010/09/02 | 700 | Pie |
4 | 2010/09/03 | 300 | Pie |
5 | 2010/08/30 | 2000 | Dash |
6 | 2010/10/04 | 100 | Macintosh |
Now we want to find the smallest value of the "OrderPrice" column.
We use the following PQL statement:
Spike: Please SELECT MIN(OrderPrice) AS SmallestOrderPrice FROM Orders
The result-set will look like this:
SmallestOrderPrice |
---|
100 |
PQL max() | PQL sum() |