Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Based on the relational schema below: Emp(eid: integer, ename: string, age: integer, salary: real) Works(eid: integer, did: integer, pcttime: integer) eptdteg er imegen Express the

image text in transcribed

image text in transcribed

Based on the relational schema below: Emp(eid: integer, ename: string, age: integer, salary: real) Works(eid: integer, did: integer, pcttime: integer) eptdteg er imegen Express the following queries in Relational Algebra. Please make use of the relational algebra operators that was introduced in class (including aggregation and grouping operators). If you believe you cannot express a given query in relational algebra, explain why not. Or if you end up making some additional assumptions in order to express the queries clearly using relational algebra, please state your assumptions a. Find the names and ages of each employee who works in both the Sales epartment and the Engineering department (assume that Sales Dept ID -101 and Engineering Dept ID- 102) Find the mamagerids of managers who manage only departments with budgets greater than $2,000,000. (Please note that if a manager manages Dept 1 and Dept 2, while Dept 1 has a budget of 1,000,000 and Dept 2 has a budget of 5,000,000, then this manager would not be included in the result list.) b. For each department with more than 18 full-time-equivalent employees, i.e., the part-time and full-time employees add up to at least that many full-time employees), find the did together with the number of employees which work in that department. c. For this question, please note that there is an attribute pettime (of Integer type) in the Works table, as the schema shows. A tuple/row in the Works Table indicates that the Employee 0002 works in Department 102 with 80% of time, which is also PART TIME. Finally, a tuple/row in the Works Table indicates that the Employee 0003 works in Department 101 with 100% of time, which is FULL TIME. The number of FULL-TIME EQUIVALENT employees within a department is calculated based on the TOTAL PCTTIME of ALL employees in the department. As noted in the question (c), a department with eighteen full-time employees and five 50% part-time employees is considered as having 18*100%+5*50%-20.5 FULL-TIME EQUIVALENT employees, and thus should be included in the result with 23 (i.e., 18+5) as the ACTUAL number of employees in the department d. Find the name, age and salary of the youngest employee in each department. Find the department(s) with the lowest average salary of employees. e. Based on the relational schema below: Emp(eid: integer, ename: string, age: integer, salary: real) Works(eid: integer, did: integer, pcttime: integer) eptdteg er imegen Express the following queries in Relational Algebra. Please make use of the relational algebra operators that was introduced in class (including aggregation and grouping operators). If you believe you cannot express a given query in relational algebra, explain why not. Or if you end up making some additional assumptions in order to express the queries clearly using relational algebra, please state your assumptions a. Find the names and ages of each employee who works in both the Sales epartment and the Engineering department (assume that Sales Dept ID -101 and Engineering Dept ID- 102) Find the mamagerids of managers who manage only departments with budgets greater than $2,000,000. (Please note that if a manager manages Dept 1 and Dept 2, while Dept 1 has a budget of 1,000,000 and Dept 2 has a budget of 5,000,000, then this manager would not be included in the result list.) b. For each department with more than 18 full-time-equivalent employees, i.e., the part-time and full-time employees add up to at least that many full-time employees), find the did together with the number of employees which work in that department. c. For this question, please note that there is an attribute pettime (of Integer type) in the Works table, as the schema shows. A tuple/row in the Works Table indicates that the Employee 0002 works in Department 102 with 80% of time, which is also PART TIME. Finally, a tuple/row in the Works Table indicates that the Employee 0003 works in Department 101 with 100% of time, which is FULL TIME. The number of FULL-TIME EQUIVALENT employees within a department is calculated based on the TOTAL PCTTIME of ALL employees in the department. As noted in the question (c), a department with eighteen full-time employees and five 50% part-time employees is considered as having 18*100%+5*50%-20.5 FULL-TIME EQUIVALENT employees, and thus should be included in the result with 23 (i.e., 18+5) as the ACTUAL number of employees in the department d. Find the name, age and salary of the youngest employee in each department. Find the department(s) with the lowest average salary of employees. e

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Pro SQL Server Administration

Authors: Peter Carter

1st Edition

1484207106, 9781484207109

Students also viewed these Databases questions

Question

2. Employees and managers participate in development of the system.

Answered: 1 week ago