Reputation: 230
I have the following relational database schema:
I want to write the following query in relational algebra without using inequalities, disjunctions or conjunctions in the selection operator:
List the names of items that had bids of $50 that did not sell.
I have come up with the following:
π iname (σ price=50 ((ITEM ⨝ BID) - π iid (SALE)))
Upvotes: 2
Views: 1441
Reputation: 3296
Your attempt is almost good.
I don't know the dimensions of your tables when one does the subtraction. One should always have the same dimension:
πiname(σprice=50((ITEM⨝BID) - πiid(ITEM⨝SALE)))
Upvotes: 2