Previous Topic: ReviewNext Topic: Using Conditional Retrieval


Scenarios

Create the appropriate statements online to retrieve the needed data:

  1. You need to list all jobs the company has for a government report. The report should show job ID, job title, and minimum and maximum rate for the job. Use the JOB table, checking Appendix C, “Table Descriptions” for table descriptions.
  2. The report you just created (in Scenario 1) has all the necessary information but is difficult to read because it is not sorted. Modify the SELECT statement to create the same report sorted by job title.
  3. Periodically, a company list is produced showing each department and all employees assigned to that department. This list should be sorted first by department ID and then by employee ID within each department. Display department ID, employee ID, and employee last name. Create the appropriate SQL SELECT statement to produce this list using the EMPLOYEE table.
  4. The report you just created is very useful except that the headings are difficult to understand. Rewrite the statement so that the column headings are "Department", "Employee ID", and "Last Name".
  5. The Human Resources department needs a report of all employees listing ID, amount of vacation accrued for each employee, and vacation accrued incremented by 32 hours, in order to see whether any employees will have over the maximum allowable vacation once the accruals have been applied. Create this report using the BENEFITS table. Name the column headings appropriately, and order the report by employee ID.

To check your answers, see Review Answers for Chapter 3.