Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


Share this Page URL
Help

Chapter 2: Relational Algebra > Intersect - Pg. 59

Intersect The difference operation looks at entire rows when it makes the decision whether to include a row in the result table. This means that the two source tables must be union compatible. Assume that the all_products table has two columns--prod_ numb and product_name--and the products_that_have_been_ purchased table also has two columns--prod_numb and order_ numb. Because they don't have the same columns, the tables aren't union-compatible. As you can see from Figure 2-14, this means that a DBMS must first perform two projections to generate the union-com- patible tables before it can perform the difference. In this case, the operation needs to retain the product number. Once the projections into union-compatible tables exist, the DBMS can perform the difference. 59