Previous Topic: Exercise 5-3Next Topic: Exercise 5-5


Exercise 5-4

Using WHERE

How many employees in department 5200 have telephones? Add a WHERE clause to your previous statement to find out.

The result looks like this:

     (EXPR)      ------           4 1 row processed

If your results do not match what you see above, check Review Answers for Chapter 5 for the correct SQL syntax.

MAX

Use the aggregate function MAX (maximum) to determine the highest value in a specified column.

How It's Done

The Human Resources department would like to know the highest salary in the company. Salaries are stored in the POSITION table. To show this information, enter:

select max(salary_amount)
       from position;

The result looks like this:

       (EXPR)        ------     146432.00 1 row processed