Previous Topic: Chapter 6 AnswersNext Topic: Glossary


Final Query

For each job, list the number of employees greater than 1 who each the minimum salary for the job's class. Display the report in order of job title:

select joblist.title, count(*) as &xq.number of employees',
    avg(salary) as salary
  from joblist, emp
  where exists (select * from jobclass
                  where emp.class=jobclass.class and
                  emp.salary = jobclass.minsalary)
    and joblist.empid=emp.empid
  group by title
  having count(*) > 1
  order by title ! display

JOBLIST/EMP REPORT mm/dd/yy TITLE NUMBER OF EMPLOYEES SALARY ──────────────────── ─────────────────── ─────────── PASTE-UP ARTIST 2 18000.00 PROGRAMMER/ANALYST 3 33000.00 END OF REPORT Glossary