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

Consider the following schema: Worker ( person-name , street, city) Works ( pers

ID: 671205 • Letter: C

Question

Consider the following schema:

Worker (person-name, street, city)

Works (person-name, business-name, salary)

Business (business-name, city)

Manages (person-name, manager-name)

Write the following queries in relational algebra:

a.) Find the names of all workers who work for Google.

b.) Find the names and cities of residence of all workers who work for Google.

c.) Find the names, street address, and cities of residence of all workers who work for Google and earn more than $65,000 per year.

d.) Find the names of all workers in this database who live in the same city as the business for which they work.

Explanation / Answer

a)
select person-name from works where business-name = 'Google';
b)
select a.person-name, b.city from works a, business b where a.person-name = b.person-name;
c)
select a.person-name, a.street, a.city from worker a, works b where a.person-name = b.person-name and b.salary >$65000;