Returns the maximum value of a set of values.
The value of the selected instance of expression.
Use $max to find the largest value among members of a set. Instances of expression that are $Null are ignored.
Expression is often a WHERE expression that includes only selected values in the operation. If the WHERE expression (expr1 WHERE expr2) is true, the expr1 value is included in the operation; otherwise, expression is considered $Null and is ignored.
compute Employees where DeptName = “Sales”
evaluate (let MaxSal = $max(Salary))
(let MinSal = $min(Salary))
(let MaxSalF = $max(Salary where Sex = “F”))
(let MinSalF = $min(Salary where Sex = “F”))
At the end of this operation, MaxSal contains the highest salary paid to any employee in Sales; MinSal contains the lowest salary paid to any employee in Sales; MaxSalF contains the highest salary paid to any female employee in Sales; and, MinSalF contains the lowest salary paid to any female employee in Sales.