資料處理時經常需要多個表單加起來處理,這個時候你就必須要對於Join跟Union要清楚了解他的作用,我們用實作來了解吧。
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 Out…