Are these two expressions correct?

Viewed 34

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:

  1. PROJECT{Quantity <5000(SUPPLY)} -> T1
  2. RESTRICT{PNo, JobNo(T1)} ->T2
  3. T2*T2.PNo = PNo(PART)-> T3
  4. RESTRICT{PNo,JobNo,PartName(T3)}->T4
  5. T4*T3.JobNo = JobNo(PROJECT) ->T5
  6. PROJECT{PartName,JobName(T5)} ->Result

My friend's answer:

  1. PROJECT{Quantity <5000(SUPPLY)} -> T1
  2. RESTRICT{PNo, JobNo(T1)} ->T2
  3. T2*T2.PNo = PART.PNo(PART)-> T3
  4. RESTRICT{PNo,JobNo,PartName(T3)}->T4
  5. T4*T3.JobNo = PROJECT.JobNo(PROJECT) ->T5
  6. PROJECT{PartName,JobName(T5)} ->Result

The difference is on T3 and T5.

0 Answers
Related