This weeks lab continues using the SELECT command in addition to now incorporating multiple tables in the FROM statement to gather information together.
Tasks
Part-A Simple Joins
(FROM <table1, table2>)
- Display the department name, city, street address and postal code for departments sorted by city and department name.
- Display full name of employees as a single field using format of Last, First, their hire date, salary, department name and city, but only for departments with names starting with an A or S sorted by department name and employee name.
- Display the full name of the manager of each department in states/provinces of Ontario, New Jersey and Washington along with the department name, city, postal code and province name. Sort the output by city and then by department name.
- Display employees last name and employee number along with their managers last name and manager number. Label the columns Employee, Emp#, Manager, and Mgr# respectively.
Part-B Non-Simple Joins
Using the JOIN statement
- Display the department name, city, street address, postal code and country name for all Departments. Use the JOIN and USING form of syntax. Sort the output by department name descending.
- Display full name of the employees, their hire date and salary together with their department name, but only for departments which names start with A or S.
- Full name should be formatted: First / Last.
- Use the JOIN and ON form of syntax.
- Sort the output by department name and then by last name.
- Display full name of the manager of each department in provinces Ontario, New Jersey and Washington plus department name, city, postal code and province name.
- Full name should be formatted: Last, First.
- Use the JOIN and ON form of syntax.
- Sort the output by city and then by department name.
- Display the department name and Highest, Lowest and Average pay per each department. Name these results High, Low and Avg.
- Use JOIN and ON form of the syntax.
- Sort the output so that department with highest average salary are shown first.
- Display the employee last name and employee number along with their managers last name and manager number. Label the columns Employee,
- Emp#, Manager, and Mgr#, respectively.
- Include also employees who do NOT have a manager and also employees who do NOT supervise anyone (or you could say managers without employees to supervise).
Reviews
There are no reviews yet.