92.3k views
0 votes
You may use the CAP database handout. Write the relational algebra statement to answer the following question. Then write the SQL statement to answer the same question.

Get cities of agents booking an order from customer c002.

User Bettina
by
5.9k points

1 Answer

1 vote

Answer and Explanation:

I'm assuming that you have two databases (since no CAP database is provided in the question) Agent, Customer.

Agent having the attributes agent_id, city, customerid etc..

Customer having customerid, customer_name etc.

Relational Algebra statement:

π customerid(Agent)(customerid =c002(Customer))

city

Query:

select city from Agent where customerid in(select customerid from Customer where customer_name="c002);

User Christian Stewart
by
6.5k points