Assuming I have two relations:

Supplier [ID (PK), Name, City, Country] and

Item [ID (PK), Name, Department, Price, Stock, Supplier_ID (FK)]

What would be the easiest way to determine the following statement both in domain and tuple relational calculus: "List the IDs and names of those suppliers, who have delivered at least three different items"?

If, for example, I had to find out if a supplier had delivered only items at a certain price range or if an item was sitting in this or that department, that would't be difficult. It's the "at least three different items" part I can't quite figure out yet. I'm assuming I'd have to juggle around tuples with several different item IDs through AND/OR operators, with some item IDs not equal to other item IDs etc.

Any help with my task would be greatly appreciated!

  • $\begingroup$ I think this can be achieved using existential quantifiers. I am rusty on TRC so leaving this as a comment $\left \{s\mid s\in Supplier \land \exists\, i \in Item(s[id]=i[supplier\_id]\,\land \exists i1,i2,i3 \land i1[id]\neq i2[id] \land i2[id]\neq i3[id] \land i1[id]\neq i3[id]) \land i1[s[id]]=i2[s[id]] \land i2[s[id]]=i3[s[id]] \right \}$ $\endgroup$
    – Rinkesh P
    Nov 29, 2022 at 7:36
  • $\begingroup$ @RinkeshP Thank you, friend. Exactly what I needed! Just wasn't quite sure how to equate or negate those item IDs. Cheers! $\endgroup$
    – T.E.
    Nov 29, 2022 at 9:51


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.