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

Question 9: (Maps to student outcome: a, b, c, k) Consider the relational databa

ID: 3875085 • Letter: Q

Question

Question 9: (Maps to student outcome: a, b, c, k) Consider the relational database whose schema is shown below: Lives (person-name, street, city) Works (person-name, company-name, salary) Located-in (company-name, city) Manages (perso-name, manager-name) The primary key for each relation is denoted by the underlined attribute. Write the following queries in Relational Algebra: a. Find the name of all employees who work for the Ruston Bank' (a specific company name b. Find the name, street, and city in the database. of all employees who work for the Ruston Bank' and earn more than $10,500.

Explanation / Answer

1)SELECT person-name from Works where person-name='Ruston Bank';
In the above query there is no need of join because we need to extract person-name who works in Ruston Bank.
To get this we need person-name and company name columns. Both of these are in a single table Works so there is no
no need of join for this query.
2)SELECT person-name,street,city from Lives L INNER JOIN Works W ON L.person-name=W.person-name where W.company-name='Ruston-Bank' and
W.salary>10500;
In this query we are applyong join on Lives and Works tables because the columns that we need to get are in Lives

table and to exactly match the query requirement we need to apply where condition and company name and salary
coulumns. But these ar not in Lives table so we are applying join on Lives and Works table and applying where condition
on required columns of Works table.

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