Friday, 31 July 2015

RELATIONAL ALZ OPERATIONS

SELECT and PROJECT

SELECT and PROJECT can be combined together. For example, to get a list of employee numbers for employees in department number 1:
Missing ALT text
Figure : Mapping select and project

Set Operations - semantics

Consider two relations R and S.
  • UNION of R and S
    the union of two relations is a relation that includes all the tuples that are either in R or in S or in both R and S. Duplicate tuples are eliminated.
  • INTERSECTION of R and S
    the intersection of R and S is a relation that includes all tuples that are both in R and S.
  • DIFFERENCE of R and S
    the difference of R and S is the relation that contains all the tuples that are in R but that are not in S.

SET Operations - requirements

For set operations to function correctly the relations R and S must be union compatible. Two relations are union compatible if
  • they have the same number of attributes
  • the domain of each attribute in column order is the same in both R and S.

UNION Example

Missing ALT text
Figure : UNION

INTERSECTION Example

Missing ALT text
Figure : Intersection

DIFFERENCE Example

Missing ALT text
Figure : DIFFERENCE

No comments:

Post a Comment