I am trying to do some examples of relational algebra. But I got a different answer from my friend and wonder which answer is correct, or whether both answers are correct. My friend keeps saying that my answer is wrong.
- SUPPLIER(SNo, SupplierName, City)
- PART(PNo, PartName, Weight)
- PRODUCT(JobNo, JobName, StartYear, Country)
- SUPPLY (SNo,PNo,JobNo,Quantity)
Question: list the Project name and Part name of any Parts where fewer than 5000 of the part has been supplied to a particular project.
My answer:
- PROJECT{Quantity <5000(SUPPLY)} -> T1
- RESTRICT{PNo, JobNo(T1)} ->T2
- T2*T2.PNo = PNo(PART)-> T3
- RESTRICT{PNo,JobNo,PartName(T3)}->T4
- T4*T3.JobNo = JobNo(PROJECT) ->T5
- PROJECT{PartName,JobName(T5)} ->Result
My friend's answer:
- PROJECT{Quantity <5000(SUPPLY)} -> T1
- RESTRICT{PNo, JobNo(T1)} ->T2
- T2*T2.PNo = PART.PNo(PART)-> T3
- RESTRICT{PNo,JobNo,PartName(T3)}->T4
- T4*T3.JobNo = PROJECT.JobNo(PROJECT) ->T5
- PROJECT{PartName,JobName(T5)} ->Result
The difference is on T3 and T5.