Relational Algebra - JOIN

Customer (Name,Country,CreditLimit)
Product (Product, Type, Price)
Shipper (Name,Country)

(1) Theta Join

SELECT *
FROM (SELECT * FROM Customer CROSS JOIN SELECT Product,Type FROM Product)
WHERE CreditLimit > Price

(2) Equi Join

SELECT *
FROM (SELECT * FROM Customer CROSS JOIN SELECT Product,Type FROM Product)
WHERE CreditLimit =2500

(3) Equi Join

SELECT *
FROM Customer, Shipper
WHERE Customer.Country=Shipper.Country


(4) Natural Join (Inner Join)

SELECT * FROM Customer Natural JOIN Shipper

(5) Left Outer Join

SELECT * FROM Customer LEFT OUTER JOIN Shipper
ONCustomer.Country=Shipper.Country


(6) Semi Join (LEFT or RIGHT)



參考資訊
http://dinesql.blogspot.tw/2017/06/relational-algebra-joins-theta-join-equijoin-natural-join-outer-join-semijoin.html

張貼留言

0 留言