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:
- 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
- Figure : UNION
INTERSECTION Example
- Figure : Intersection
DIFFERENCE Example
- Figure : DIFFERENCE
No comments:
Post a Comment