Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

The HR _ JOB _ HISTORY table stores job history of the employees. If an employee changes departments within the job or changes jobs within

The HR_JOB_HISTORY table 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. Create a query that will show the concatenated first and last name of all employees in the HR.JOB_HISTORY table along with their old job title and old department name and their new job title and new department name.Here are the TABLES: --------------------------------------------------------
-- DDL for Table HR_COUNTRIES
--------------------------------------------------------
CREATE TABLE HR_COUNTRIES
( COUNTRY_ID CHAR(2),
COUNTRY_NAME VARCHAR2(40),
REGION_ID NUMBER
);
--------------------------------------------------------
-- DDL for Table HR_DEPARTMENTS
--------------------------------------------------------
CREATE TABLE HR_DEPARTMENTS
( DEPARTMENT_ID NUMBER(4,0),
DEPARTMENT_NAME VARCHAR2(30),
MANAGER_ID NUMBER(6,0),
LOCATION_ID NUMBER(4,0)
);
--------------------------------------------------------
-- DDL for Table HR_EMPLOYEES
--------------------------------------------------------
CREATE TABLE HR_EMPLOYEES
( EMPLOYEE_ID NUMBER(6,0),
FIRST_NAME VARCHAR2(20),
LAST_NAME VARCHAR2(25),
EMAIL VARCHAR2(25),
PHONE_NUMBER VARCHAR2(20),
HIRE_DATE DATE,
JOB_ID VARCHAR2(10),
SALARY NUMBER(8,2),
COMMISSION_PCT NUMBER(2,2),
MANAGER_ID NUMBER(6,0),
DEPARTMENT_ID NUMBER(4,0)
);
--------------------------------------------------------
-- DDL for Table HR_JOBS
--------------------------------------------------------
CREATE TABLE HR_JOBS
( JOB_ID VARCHAR2(10),
JOB_TITLE VARCHAR2(35),
MIN_SALARY NUMBER(6,0),
MAX_SALARY NUMBER(6,0)
);
--------------------------------------------------------
-- DDL for Table HR_JOB_HISTORY
--------------------------------------------------------
CREATE TABLE HR_JOB_HISTORY
( EMPLOYEE_ID NUMBER(6,0),
START_DATE DATE,
END_DATE DATE,
JOB_ID VARCHAR2(10),
DEPARTMENT_ID NUMBER(4,0)
);
--------------------------------------------------------
-- DDL for Table HR_LOCATIONS
--------------------------------------------------------
CREATE TABLE HR_LOCATIONS
( LOCATION_ID NUMBER(4,0),
STREET_ADDRESS VARCHAR2(40),
POSTAL_CODE VARCHAR2(12),
CITY VARCHAR2(30),
STATE_PROVINCE VARCHAR2(25),
COUNTRY_ID CHAR(2)
);
--------------------------------------------------------
-- DDL for Table HR_REGIONS
--------------------------------------------------------
CREATE TABLE HR_REGIONS
( REGION_ID NUMBER,
REGION_NAME VARCHAR2(25)
);

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions