Consider the schema below and specify the queries using relational algebra. Plea
ID: 3740835 • Letter: C
Question
Consider the schema below and specify the queries using relational algebra. Please submit the answers in PDF or Word to Canvas. EMPLOYEE Fname Lname SSN BirthDate Sex Salary SuperSSN DNo DEPARTMENT | DName | DNumber | MGRSSN | MGRStartDate PROJECT | PName PNumber PLocation Dnum | WORKS ON ESIN PNo Hours 1. Retrieve the names (first name, last name) of male employees whose department manager is “Jim Benson”. 2. Retrieve the names (first name, last name) of employees in department 5 who work more than 10 hours per week on the ‘ProjectX' project. (5 is the department number.) 3. Retrieve the names (first name, last name) of employees who do not work on any project. 4. Retrieve the names (first name, last name) of employees in department 4 whose supervisor is “Alice Karl”. 5. Retrieve locations of projects that “Ellie Collins” works on.Explanation / Answer
--1)
SELECT Fname, Lname
FROM EMPLOYEE E, DEPARTMENT D, EMPLOYEE M
WHERE E.DNo = D.DNumber AND D.MGRSSN = M.SSN AND Sex = 'male' AND M.Fname = 'Jim' AND M.LName = 'Benson';
--2)
SELECT Fname, LName
FROM EMPLOYEE, WORKS_ON, PROJECT
WHERE SSN=ESSN AND PNo = PNumber AND DNo = 5 AND PNAME='ProductX' AND HOURS>10
--3)
SELECT Fname, Lname
FROM EMPLOYEE
WHERE NOT EXISTS (
SELECT *
FROM WORKS_ON
WHERE ESSN=SSN);
--4)
SELECT Fname, Lname
FROM EMPLOYEE E, EMPLOYEE S
WHERE E.SuperSSN = S.SSN AND DNo = 5 AND S.Fname = 'Alice' AND S.Lname = 'Karl';
--5)
SELECT PLocation
FROM PROJECT, WORKS_ON, EMPLOYEE
WHERE PNumber = PNo AND SSN = ESSN AND Fname = 'Ellie' AND Lname = 'Collins';