Given the following table schema
customer (name: string, credit: integer)
allowance (no: string, type: string)
asker(cname: string, lno: string)
asker.cname and asker.lno are foreign keys referencing customer, respectively allowance , whose keys are name, respectively no (number)
I am trying to write the relational algebra for the query to find pairs of names of customers who share the same allowance. Avoid listing a customer with himself (Tim, Tim) and avoid listing the same over and over (ex. (Tim, Jane) and (Jane, Tim) should be one)
I have tried is:
ρ(Cust1, π no (allownace)
ρ(Cust2, π no (allownace)
π name, name((Cust1 ∩ Cust2)(customer))
I believe this is incorrect. Specially, I am having trouble where I need to find customers with the same allowance and also avoiding the customer himself and repeating.