Another couple of useful tools are the
MAX and MIN operators that allow you to grab the boundary values
in a column (alphanumeric). The most generic syntax follows
something like:
SELECT MAX (column_name)
FROM table_name
WHERE where_clause [optional];
For example, consider the following case in
which we grab the employee with the
highest salary:
SELECT MAX (EMP_SALARY)
FROM EMPLOYEES;
In this case, we would get the
following:
MAX (EMP_SALARY)
----------------
90000
----------------
Of course, you can also redefine the
column name in the view by assigning the MAX or MIN value to
a column name such as in the following case:
SELECT top_salary = MIN (EMP_SALARY)
FROM EMPLOYEES
WHERE EMP_COMMISSION = '20%';
In this case, we would get the
following:
top_salary
----------------
40000
----------------