You are on page 1of 3

Student Number: _____________________________

Student Name : ______________________________

Supplementary Activity

Part I. ADB and HR Schema Workspace snippet.

Part II. Single and Group Functions, Joining Multiple Tables.

1.) Display the regions and the number of countries that belongs for each region. Do not include US,
UK, and CA.

2.) Display the average salary, the total of the commission for each department. ”. Set the value of
commission percentage to 4% for those with no commission else 5.5%. Exclude those group with
maximum salary more than 10,000. Format the numbers to appear like: 100,000.50.

3.) Display the employee id, and new salary based on the table below.

Department ID New Salary

20 2% salary increase

40 2.5% salary increase

80 3% salary increase

Others 1.5% salary increase

4.) Display the employee id, job title, and department name for all employees. Include only those who
left the company in the year 1998 as Sales Representative or Programmer and worked in the
company for less than 2 years.

5.) Display the employee id, job title, commission pct (set to “No Comm” for those with no commission), salary
increase (set to 2000 for those with commission else 3000). Include only those departments in the city of
Sydney, Toronto, Seattle, London, and Tokyo.

6.) Display the department_id, job_id, the number of employees who worked for each department as
“Number of Employees”, employees average number of years reported in the company as “AVG
Years Reported”. Include only those employees hired from 1998 to 1999 and with AVG Years
Reported more than 3.

7.) Determine how many employees have worked in the company for more than 3 years in the years
1996 to 1998. Include only those under Marketing and Sales departments. Order the result by
year.
8.) List all department name located in Canada.

9.) Display the employee name, job title, department name, and the last date the employee has reported to
work. The report must display only records under Marketing, Sales, and Accounting department. Order the
results according to department name in ascending order.

10.) Display the employee id, job title, last day of work and department name for all employees who
left the company in the year 1994, 1996, and 1998 with managerial position.

11.)Prompt the user to enter a region name then list all departments in that particular region.

12.)Display the average salary, number of employees who were hired in the year 1993 and left the company
from the year 1997 to 1999. Exclude those with managerial positions.

13.)Display the employee id, number of years worked (round to whole number) as “YW”, the day the employee
has started as “Day”, department name, and region name. Include only those departments from the
countries of United Kingdom and Canada with job title as “Sales Representative”.

14.) Display the last name, hire date, day of the hire date, “salary review date” which is six months after
the hire date, department_name, city and country name. Transform the salary review date to appear
in the format similar to “1995 JAN 12”. Exclude those with managerial position.

15.) Create a query to display the employee id and the number of weeks employed as “Tenure” for
all employees in department 90. Show the number of weeks as whole number (no rounding).

Part III. Using Subquery.

1. The HR department needs a query that prompts the user for an employee last name. The query then displays
the last name and hire date of any employee in the same department as the employee whose name they supply
(excluding that employee). For example, if the user enters Zlotkey, find all employees who work with Zlotkey
(excluding Zlotkey).

2. Create a report that displays the employee number, last name, and salary of all employees who earn more
than the average salary. Sort the results in order of ascending salary.

3. The HR department needs a report that displays the last name, department number, and job ID of all
employees whose department is located in the city of Seattle.
Modify the query so that the user is prompted for a city.

4. Create a report for HR that displays the last name and salary of every employee who reports to King.
5. Create a report for HR that displays the department number, last name, and job ID for every employee in the
Executive department.

You might also like