Precedence of Relational Operations


( L × M ) where L.city = M.city

L × M where L.city = M.city

L × ( M where L.city = M.city )
Precedence Operators Symbol
Highest PROJECT R[ ]
SELECT R where C
Times ×
JOIN
DIVIDEBY

÷
INTERSECTION
Lowest UNION
DIFFERENCE


Query: Find those cities where we have either customers who have a discount of less than 10% or agents who make a commission of less than 6%.

customer
cid cname city discnt
c001 TipTop Duluth 10.00
c002 Basics Dallas 12.00
c003 Applied Dallas 8.00
c004 ACME Duluth 8.00
c006 ACME Kyoto 0.00
agent
aid aname city percent
a01 Smith New York 6
a02 Jones Newark 6
a03 Brown Tokyo 7
a04 Gray New York 6
a05 Otasi Duluth 5
a06 Smith Dallas 5


(CUSTOMER where discnt < 10)[city] ∪
(AGENT where percent < 6)[city]
city
Dallas
Duluth
Kyoto