3. Practice exercise 6.2 from the textbook. Given following schemas EMPLOYEE(PER
ID: 3585908 • Letter: 3
Question
3. Practice exercise 6.2 from the textbook. Given following schemas EMPLOYEE(PERSONNAME, STREET, CITY), WORKS(PERSONNAME, COMPANYNAME, SALARY) COMPANY COMPANYNAME CITY), and MANAGES(PERSONNAME, MANAGERNAME), write relational algebra expressions for the following queries. (6 points) Find the names of all employees who live in the same city and on the same street as do their managers a) b) Find the names of all employees in this database who do not work for First Bank Corporation (assuming that all people work for exactly one company and people are allowed to appear in the database (e.g. in EMPLOYEE) but not appear in WORKS.) c) Find the names of all employees who earn more than every employee of "Small Bank Corporation".Explanation / Answer
A.SELECT E.PERSONNAME
FROM EMPLOYEE E,MANAGES M,EMPLOYEE R
WHERE E.PERSONNAME=M.PERSONNAME
AND M.MANAGERNAME=R.PERSONNAME AND
E.STREET=R.STREET AND E.CITY=R.CITY
B.SELECT PERSONNAME
FROM EMPLOYEE
WHERE PERSONNAME IN(SELECT PERSONNAME
FROM WORKS
WHERE COMPANYNAME<>'First Bank Corporation')
C.SELECT SALARY FROM WORKS
WHERE SALARY >ALL(SELECT SALARY FROM WORKS
WHERE COMPANYNAME='Small Bank Corporation')
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.