In the Human Resource (HR) records, each employee has an identification number, e-mail address, job identification code, salary, and manager. Some employees earn commissions in addition to their salary.
The company also tracks information about jobs within the organization. Each job has an identification code, job title, and a minimum and maximum salary range for the job. Some employees have been with the company for a long time and have held different positions within the company. When an employee resigns, the duration the employee was working, the job identification number, and the department are recorded.
The sample company is regionally diverse, so it tracks the locations of its warehouses and departments. Each employee is assigned to a department, and each department is identified either by a unique department number or a short name. Each department is associated with one location, and each location has a full address that includes the street name, postal code, city, state or province, and the country code.
In places where the departments and warehouses are located, the company records details such as, the country name, currency symbol, currency name, and the region where the country resides geographically.
This figure shows the tables in the HR schema and the columns in each table, as well as dependencies between the tables.
The job_history has columns employee_id (primary key), start_date (primary key), end_date, job_id, and department_id. Each job history record must be associated with one employee in the employees table.
The jobs
table has the columns job_id (primary key), job_title, min_salary, and max_salary
. Each job may be related to one or more employees in the employees table.
The departments
table has columns department_id (the primary key), department_name, manager_id, and location_id. Each department must be related to one or more employees in the employee table and must be related to one location in the locations table.
The employees table has columns employee_id (primary key), first_name, last_name, email, phone_number, hire_date, job_id, salary, commission_pct, manager_id, and department_id. Each employee must be related to one department in the departments table and one job in the jobs table, and may be related to one or more records in the job_history table.
The locations table has columns location_id
(primary key), street_address
, postal_code, city, state_province, and country_id. Each location may be associated with one or more departments and must be associated with one country.
The countries table has columns country_id (primary key), country_name, and region_id. Each country may be related to one or more locations and must be associated with one region.
The regions table has columns region_id (primary key) and region_name. Each region may be associated with one or more countries.