Formulate the following queries in relational algebra 5.14 List all employees. 5
ID: 3789706 • Letter: F
Question
Formulate the following queries in relational algebra
5.14 List all employees.
5.15 List all the details of employees who are female and born after 1990.
5.16 List all employees who are not managers and are paid more than $1500.
5.17 Produce a list of the names and addresses of all employees who work for the IT department.
5.18 Produce a list of the names of all employees who work on the SCCS project.
The following tables form part of a database held in an RDBMs: Employee empNo, fName, IName, address, DOB, sex, position, deptNo) Department (deptNo, deptName, mgrEmpNo) Project (projNo, projName, deptNo) Works on em projNo, dlateWorked, hoursWorked) where Employee contains employee details and empNo is the key Department contains department details and deptNo is the key. mgrEmpNo identifies the employee who is the manager of the department. There is only one manager for each department. contains details of the projects in each department and the key is projNo (no Project two departments can run the same project). and Works On contains details of the hours worked by employees on each project, and empNo projNoldateWorked form the key!Explanation / Answer
5.14 List all employees :
Ans- select * from Employee;
5.15 List all the details of employees who are female and born after 1990.
Ans: select * from Employee where sex = 'female' and DOB > 1990
5.16 List all employees who are not managers and are paid more than $1500.
Ans: There is no table which gives us the salary kindly provide the correct schema for salary
5.17 Produce a list of the names and addresses of all employees who work for the IT department.
Ans: select emp.fName, emp.lName, emp.address from Employee emp , Department dept where emp.deptNo = dept.deptNo and deptName = 'IT';
5.18 Produce a list of the names of all employees who work on the SCCS project.
Ans:
SELECT e.lName, e.fName
FROM Project P , Employee e, Department d
WHERE e.deptNo = d.deptNo
AND d.deptNo = p.deptNo
AND p.projName = 'SCCS'