Question: Consider the Customers-Agents-Products (CAP) database with the schema below. CUSTOMERS (cid, cname, city, discnt) AGENTS (aid, aname, city, percent) PRODUCTS (pid, pname, city, quantity, price)

Consider the Customers-Agents-Products (CAP) database with the schema below.

CUSTOMERS (cid, cname, city, discnt)

AGENTS (aid, aname, city, percent)

PRODUCTS (pid, pname, city, quantity, price)

ORDERS (ordno, month, cid, aid, pid, qty, dollars)

In all the queries, you should pose the query as a single, self-contained RA expression that does not depend on any intermediate results created by means of an alias, except when it is absolutely necessary.

Q1: get the names of agents who have ordered products for customer John Anderson.

Q2: Get the names of products that have been ordered by customers living in the same city in which the product is produced.

Q3: Get the names of products that have never been ordered by customers living in the same city in which the product is produced.

Q4: Get the names of agents who have never ordered a product produced in the same city that they reside in.

Q5: Get the names of agents who have only ordered products for customers living in the same city that they reside in.

Please answer in RA query

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!