Enterprise Edition Home | Express Edition Home | Previous Page | Next Page   Data Types and Expressions > Expression >

MAX Function

The MAX function returns the largest value in the specified column or expression. Using the DISTINCT keyword does not change the results. The query in the following example finds the most expensive item that is in stock but has not been ordered:

SELECT MAX(unit_price) FROM stock
   WHERE NOT EXISTS (SELECT * FROM items 
      WHERE stock.stock_num = items.stock_num AND
      stock.manu_code = items.manu_code)

NULLs are ignored unless every value in the column is NULL. If every column value is NULL, the MAX function returns a NULL for that column.

Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]