Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Given are the following relations: Specify the following queries as relation alg

ID: 3705420 • Letter: G

Question

Given are the following relations:

Specify the following queries as relation algebra expressions:

a) In which locations do the employees live?
b) Issue a list of employee names and salaries.
c) What are the names of the employees who work in projects?
d) The names of the employees who work in the "Data Warehouse" project.
e) What is the name of the employee who manages the intranet project and what is his profession?
f) What are the employees who do not work in projects?
g) For each of the expressions, think of an alternative expression that comes to the same result.
Indicate which term you think could be faster (with justification).

Salary 4500 5600 Name Max Welly Martin Sara Hani city Kali Hari Oman Hafof Hafof Job Programmer Analyst Advertising expert 8000 Engineer Administrator Emp num 112 205 Employee 6400 198 199 5000 Pro description Proi manager Pro num 12 18 17 Name Datawarehouse intranet Project DBMigration VU Project 205 198 198 Proz 100 20 70 30 80 50 Emp num 112 205 Pro num 12 18 17 17 18 Emp programm 198 198 198

Explanation / Answer

Hi.. Please check below,

Specify the following queries as relation algebra expressions:

a) In which locations do the employees live?

Ans:
select distinct city from Employee;

from the above query we get the list of cities where employees are resides. in above query i have used distinct for remove duplicate names that was already in the list.

b) Issue a list of employee names and salaries.

Ans:
select Name,Salary from Employee;

it list out list of all employee names and salaries.

c) What are the names of the employees who work in projects?

Ans:
select a.Name from Employee a, Emp_programm b where a.Emp_num=b.Pro_num;

In the above we are joining two tables and get the names of employees that are work in projects.

d) The names of the employees who work in the "Data Warehouse" project.

Ans:
select a.Name from Employee a, Emp_programm b where a.Emp_num=b.Pro_num and b.Pro_num in (select c.Pro_num from Project c,Emp_programm d where c.Pro_num=d.Pro_num and c.Name='Datawarehouse');

From the above i have written subquery to get list of project codes and added in where condition.

e) What is the name of the employee who manages the intranet project and what is his profession?

Ans: select a.Name,'Project Manager' from Employee a, Project b where a.Emp_num = b.Proj_manager and b.Name='intranet';

In the above i have joined two tables and get the result.

f) What are the employees who do not work in projects?

Ans: select a.Name from Employee a, Emp_programm b where a.Emp_num<>b.Pro_num;

In the above i have joined two tables and and added not equal condition to the query.

g) For each of the expressions, think of an alternative expression that comes to the same result.
Indicate which term you think could be faster (with justification).

Ans: I have given explanation for each of questions above.

Please check above answers and let me know any querries. Thank you. All the best.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote