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

留言

這個網誌中的熱門文章

如何使用EXCEL連接MYSQL

關聯模式的五大鍵 Super key、Candidate Key、Primary Key、Alternate Key、Foreign Key

SELECT SQL語法總整理