-4

I have go through this but I couldn't understand. Can I join reation without primary key or partial key? If yes what is the answer for following question.

enter image description here

enter image description here

1 Answer 1

3

Yes, you can join on any columns in a query. Primary and Foreign Keys are for Referential Integrity.

Select Item.IName, Item_Supply.AvailableQuantity
From Item
Join Item_Supply ON Item.ItemKey = Item_Supply.ItemKey
JOIN Supplier ON Item_Supply.SupplierKey = Supplier.SupplierKey
JOIN Country ON Supplier.NationKey = Country.CountryKey
JOIN Region ON Country.RegionKey = Region.RegionKey
Where Item_Supply.AvailableQuantity > 1000
AND Region.RName = 'East Asia'
3
  • Not sure what DBMS you are using, but I coded MSSQL
    – SS_DBA
    Commented Oct 10, 2016 at 17:09
  • I need relational algebra not a sql query
    – Blasanka
    Commented Oct 10, 2016 at 17:25
  • 2
    So you should be able to convert my select statement into your relational algebra. If you can post your answer after, I'd like to see the result.
    – SS_DBA
    Commented Oct 10, 2016 at 17:30

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.