The database used for this question is a very simple one with the following schema: (Primary keys are bold, foreign keys are underlined) CUSTOMER (CustID, FirstName, LastName, City, Phone, Email) INVOICE (InvoiceNumber, CustID, Date) INVOICE_ITEM(InvoiceNumber, ItemNumber, Quantity) ITEM (ItemNumber, ItemName, UnitPrice) When a customer makes a purchase, an invoice is created. The invoice may be for many items. For example, in a single purchase, a customer might buy 10 Back Scratchers, 4 Hair Removers and a Dog Lead. Provide relational algebra (NOT SQL) queries to find the following information. NOTE: You can use the symbols s, P, etc., or the words’ PROJECT’, ‘RESTRICT’ etc. as you prefer. You do not need to try to make efficient queries – just correct ones. Where you use a join, always show the join condition. A) List the first and last names of customers who have bought “Back Scratcher” and “Hair Remover” B) List the first and last names of any customers who have bought all of the items listed in the Item relation. (This does not need to be as part of a single purchase).
The
CUSTOMER (CustID, FirstName, LastName, City, Phone, Email)
INVOICE (InvoiceNumber, CustID, Date)
INVOICE_ITEM(InvoiceNumber, ItemNumber, Quantity)
ITEM (ItemNumber, ItemName, UnitPrice)
When a customer makes a purchase, an invoice is created. The invoice may be for many items. For example, in a single purchase, a customer might buy 10 Back Scratchers, 4 Hair Removers and a Dog Lead.
Provide relational algebra (NOT SQL) queries to find the following information.
NOTE:
- You can use the symbols s, P, etc., or the words’ PROJECT’, ‘RESTRICT’ etc. as you prefer.
- You do not need to try to make efficient queries – just correct ones.
- Where you use a join, always show the join condition.
A) List the first and last names of customers who have bought “Back Scratcher” and “Hair Remover”
B) List the first and last names of any customers who have bought all of the items listed in the Item relation. (This does not need to be as part of a single purchase).
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images