Professional Documents
Culture Documents
Version 3.1
Hanoi, 11/2020
Training Assignments SQL Issue/Revision: x/y
RECORD OF CHANGES
Contents
For the following assignments: ........................................................................................................4
Basic Queries in SQL ......................................................................................................................4
Assignment 2_Opt1: Human Resource Management System......................................................4
CODE: Assignment2_Opt1
TYPE: Medium
LOC: n/a
DURATION: 180 MINUTES
HR_DB_Scripts_Full.sql
Write SQL statements for following activities & print out respectively the screenshots to show test data (the
table data that you create to test each query) & query results:
1. Add at least 8 records into each created table. Note that the input data must have meaning, avoid
inputting data like ‘abc’, ‘xyz’.
3. Update department name to 'ITS' for the department that has department id is 60 (Departments table).
4. Update manager id to 122 for the departments that have id is 120 and 130 (Departments table).
5. Update commission pct to 0.25 for employees (Employees table) who started working in 2008 (YEAR
(hire_date)=2008).
6. Update the min_salary to 3000 for the job with job_title 'Shipping Clerk' (Jobs table).
7. Write a query to retrieve (select) jobs for which job_title contains 'clerk' (Jobs table, using LIKE operator)
Results:
8. Write a query to retrieve jobs where the minimum salary is from 5000 and the maximum salary from
10000.
Results:
Results:
10. Write a query to retrieve the employees (employee_id, full_name, phone_number, hire_date, job_id) who
work in the department with id 210.
Results:
11. Write a query to retrieves the employees (employee_id, first_name, last_name, email) and the
employee's job (job_title).
Results:
12. Write a query to retrieves the employees (employee_id, first_name, last_name) and the employee's job
history (use JOIN between Employees, Job_History, Job, Department).
Results:
employ
first_name last_name start_date end_date job_title department_name
ee_id
101 Neena Kochhar 1997-09-21 2001-10-27 Public Accountant Corporate Tax
101 Neena Kochhar 2001-10-28 2005-03-15 Accounting Manager Corporate Tax
102 Lex De Haan 2001-01-13 2006-07-24 Programmer Treasury
114 Den Raphaely 2006-03-24 2007-12-31 Stock Clerk Shareholder Services
122 Payam Kaufling 2007-01-01 2007-12-31 Stock Clerk Shareholder Services
176 Jonathon Taylor 2006-03-24 2006-12-31 Sales Representative Construction
176 Jonathon Taylor 2007-01-01 2007-12-31 Sales Manager Construction
200 Jennifer Whalen 1995-09-17 2001-06-17 Administration Assistant Contracting
200 Jennifer Whalen 2002-07-01 2006-12-31 Public Accountant Contracting
201 Michael Hartstein 2004-02-17 2007-12-19 Marketing Representative Control And Credit
-- THE END --