Question: did I do this correctly relational algebraic expressions for the following queries and how would their query trees look like. Consider the following relational schema
did I do this correctly relational algebraic expressions for the following queries and how would their query trees look like.
Consider the following relational schema and briefly answer the questions that follow. Make any assumptions ad state them as part of your answer.
Emp eid: integer, ename: string, age: integer, salary: real, bonus:real
Works eid: integer, did: integer, pcttime: integer
Dept did: integer, dname: string, budget: real, managerid: integer
Write relational algebraic expressions for the following queries and draw their query trees.
a Retrieve the names of department where John Smith works.
EmpJS enameJohnSmithEmp
DeptJS did Works eid EmpJS
Deptnamesresult dnameDept did DeptJS
b List all employees who work for a manager younger than themselves.
ManagerInfo Emp AS E managerid Dept
ManagerEmpInfo ManagerInfo eid Works.eid Emp AS E
YoungerMangers enameEage EageManagerEmpInfo
c List all employees who do not work in any department managed by Jane Smith
EmpJaneS ename 'Jane Smith'Emp
DeptJaneS did Dept managerid EmpJaneS
EmpJaneSDept eidWorks did DeptJaneS
ExcludedEmployees eidEmp EmpJaneSDept
d List all employees who work in every department managed by Jane Smith
EmpJaneS ename Jane Smith'Emp
DeptJaneS didDept managerid EmpJaneS
EmpJaneSDepts eidWorks did DeptJaneS
EmployeesAllDepts eidEmp didDeptJaneS
e List all departments were everyone who works is above years old.
DeptEmp Works eid Emp
DeptOlderEmp didage DeptEmp
f Find managers who manage more than one department.
DeptManagers managerid countdidDept
MultiDeptManagers countdidDeptManagers
g Find a manager who works more than any of hisher employees in any department.
ManagerDetails Dept managerid Emp AS Manager
EmployeeDetails Works eid Emp AS Employee
ManagersWithHigherWork manageridManagersalary Employee.salaryManagerDetails EmployeeDetails
h Find total hours worked by all employees in department number
DeptEmp didWorks
TotalHoursDept SUMpcttimeDeptEmp
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
