HR
| Table Name: | JOB_HISTORY |
| Description: | Table that stores job history of the employees. If an employee changes departments within the job or changes jobs within the department, new rows get inserted into this table with old job information of the employee. Contains a complex primary key: employee_id+start_date. Contains 25 rows. References with jobs, employees, and departments tables. |
| Primary Keys: | EMPLOYEE_ID START_DATE |
| Field | Type | Defaults | Nulls? | Comments |
|---|---|---|---|---|
| EMPLOYEE_ID | NUMBER (6) | None | No | A not null column in the complex primary key employee_id+start_date. Foreign key to employee_id column of the employee table |
| START_DATE | DATE | None | No | A not null column in the complex primary key employee_id+start_date. Must be less than the end_date of the job_history table. (enforced by constraint jhist_date_interval) |
| END_DATE | DATE | None | No | Last day of the employee in this job role. A not null column. Must be greater than the start_date of the job_history table. (enforced by constraint jhist_date_interval) |
| JOB_ID | VARCHAR2 (10) | None | No | Job role in which the employee worked in the past; foreign key to job_id column in the jobs table. A not null column. |
| DEPARTMENT_ID | NUMBER (4) | None | Yes | Department id in which the employee worked in the past; foreign key to deparment_id column in the departments table |
| Index | Type | Unique? | Fields |
|---|---|---|---|
| JHIST_DEPARTMENT_IX | NORMAL | NORMAL | DEPARTMENT_ID |
| JHIST_EMPLOYEE_IX | NORMAL | NORMAL | EMPLOYEE_ID |
| JHIST_EMP_ID_ST_DATE_PK | NORMAL | NORMAL | EMPLOYEE_ID START_DATE |
| JHIST_JOB_IX | NORMAL | NORMAL | JOB_ID |
| Check Constraint | Text |
|---|---|
| JHIST_DATE_INTERVAL | end_date > start_date |
| Internal Foreign Key Constraint | Affected Field | Source Table | Source Schema |
|---|---|---|---|
| JHIST_DEPT_FK | DEPARTMENT_ID | DEPARTMENTS | HR |
| JHIST_EMP_FK | EMPLOYEE_ID | EMPLOYEES | HR |
| JHIST_JOB_FK | JOB_ID | JOBS | HR |