Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

employee (employee-id , employee-name, street, city) works( employee-id , company-id, salary) company( company-id , company-name, city) manages( employee-id , manager-id) Consider the data base above

employee(employee-id, employee-name, street, city)

works(employee-id, company-id, salary)

company(company-id, company-name, city)

manages(employee-id, manager-id)

Consider the data base above where the primary keys are in bold

For each of the questions give the following. (NOTICE the Relations on the given database it isn't like the ones that are commonly posted they are slightly different)

(1) a relational algebra expression,

(2) a tuple relational calculus expression, and

(3) a domain relational calculus expression.

c. Find the names, street addresses, and cities of residence of all employees who work for First Bank Corporation and earn more than $10,000.

SQL Query

select distinct employee-name, street-number, street, city from (employee natural join works) natural join company where company-name = First Bank Corporation and salary >$10,000;

d. Find all employees in the database who live in the same cities as the companies for which they work.

SQL Query

select distinct employee-name, city from (employee natural join works) natural join company Note: the rightmost natural join enforces company.city = employee.city.

e. Find all employees in the database who live in the same cities and on the same streets as do their managers.

//find managers along their addresses with manager(ID, street, city) as select employee-id, street, city from employee, manages where employee.employee-id = manages.manager-id //find those employees who live in the same cities and //on the same street as do their managers. select distinct employee-name, street, city from (employee natural join manages), manager Where manages.manager-id = manager.ID and employee.street = manager.street and

employee.city = manager.city

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

OpenStack Trove

Authors: Amrith Kumar, Douglas Shelley

1st Edition

1484212215, 9781484212219

More Books

Students also viewed these Databases questions