Question
QUESTION 5 Answer all parts Consider the following relational schema for a HR database: REGIONS(RegionID, RegionName) COUNTRIES(CountryID, CountryName, RegionID) LOCATIONS(LocationID, Address, City, CountryID) DEPARTMENTS(DepartmentID, DepartmentName,
QUESTION 5 Answer all parts Consider the following relational schema for a HR database: REGIONS(RegionID, RegionName) COUNTRIES(CountryID, CountryName, RegionID) LOCATIONS(LocationID, Address, City, CountryID) DEPARTMENTS(DepartmentID, DepartmentName, ManagerID, LocationID) EMPLOYEES(EmployeeID, FirstName, LastName, Email, Phone, JobID, Salary, DepartmentID, ManagerID) JOBS(JobID, JobTitle, MinimumSalary, MaximumSalary) JOB-HISTORY(EmployeeID, StartDate, EndDate, JobID, DepartmentID) The primary keys are underlined. The foreign keys are in italics. Each region has many countries, while each country has many (company) locations. Each location has many departments and each Page 5 of 5 department has many employees working in it. Many employees are managed by each manager in a department. The database also stores information about an employees job history. Write SQL queries to answer the following: (a) Write a query to get the total salary, maximum, minimum, average salary of employees (job ID wise), for department ID DT90 only. (5 marks) (b) Write a query to find the name (first name, last name) of all employees who work in the IT department. (5 marks) (c) Write a query to find the name (first_name, last_name) of the employees who are not supervisors. (5 marks) (d) Write a query to find the name (first name, last name), job ID, department ID of the employees who work in London. (5 marks) (e) Write a query to display the job history that were done by any employee who is currently drawing more than 6000 of salary. (5 marks)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started