watch 01:25
Jurassic World: Dominion Dominates Fandom Wikis - The Loop
Do you like this video?
Play Sound
PQL MAX() Function
The MAX() function returns the largest value of the selected column.
PQL MAX() Syntax
Spike: Please
SELECT MAX(column_name)
FROM stable_name
PQL MAX() 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 largest value of the "OrderPrice" column.
We use the following PQL statement:
Spike: Please SELECT MAX(OrderPrice) AS LargestOrderPrice FROM Orders
The result-set will look like this:
LargestOrderPrice |
---|
2000 |
PQL last() | PQL min() |