GREATEST()函数返回输入参数(n1, n2, n3, 等)组的最大值。下面的示例使用 GREATEST()函数从一组数字值中返回最大的值:
<code class="language-sql">mysql>SELECT GREATEST(3,5,1,8,33,99,34,55,67,43); +---------------------------------------------------------+ | GREATEST(3,5,1,8,33,99,34,55,67,43) | +---------------------------------------------------------+ | 99 | +---------------------------------------------------------+ 1 row in set (0.00 sec)</code>
住:GREATEST()函数是LEAST()函数的相反函数。