Question
CSC - Database The following database is given: BUYER Name Age Gender Alice 20 Female Bob 21 Male Carol 18 Female CARD CardNum Owner Limit
CSC - Database The following database is given:
BUYER
| CARD
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
PRODUCT
| ORDER
|
Note:
Underline indicates Primary Key
Foreign Key (Buyer) in ORDER references BUYER (Name)
Foreign Key (Product in ORDER references PRODUCT (PName)
Foreign Key (Owner) in CARD references BUYER (Name)
Buyers can own one or more cards. Buyers can order one or more products.
In each of the following problems a Relational Algebra expression given.
You are asked to hand-compute the expression and type-in (or write-in) the result set below the expression.
6. Intersection Example
(PROJECT (PRODUCT.PName, ORDER.Buyer)
(SELECT (PRODUCT.Price <= 10)
(JOIN (PRODUCT.PName = ORDER.Product) PRODUCT, ORDER)))
(PROJECT (PRODUCT.PName, ORDER.Buyer)
(SELECT (ORDER.Count <= 2)
(JOIN (PRODUCT.PName = ORDER.Product) PRODUCT, ORDER)))
(4 pts)
Do it step by step
A= (JOIN (PRODUCT.PName = ORDER.Product) PRODUCT, ORDER)
B = (SELECT (PRODUCT.Price <= 10) A)
C = (PROJECT (PRODUCT.PName, ORDER.Buyer) B)
D = (SELECT (ORDER.Count <= 2) A)
E = (PROJECT (PRODUCT.PName, ORDER.Buyer) D)
Final Answer C INTERSECTION E
7. Set Difference Example
(PROJECT (PName) (SELECT (Weight >= 500) PRODUCT))
(PROJECT (Product) (SELECT (Buyer = 'Carol' OR Buyer = 'Alice') ORDER) (3 pts)
DO it step by step:
A = (PROJECT (PName) (SELECT (Weight >= 500) PRODUCT))
B= (PROJECT (Product) (SELECT (Buyer = 'Bob' OR Buyer = 'Alice') ORDER)
A B
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started