Databases Reference
In-Depth Information
The result will be a long narrow relation:
Salesperson
Salesperson
Number
Name
137
Baker
186
Adams
204
Dickens
361
Carlyle
If we project a nonunique attribute, then a decision must be made on whether
or not we want duplicates in the result (although, since the result is itself a relation,
technically there should not be any duplicate rows). For example, whether:
Project the Year of Hire over the SALESPERSON relation.
produces
Year Of Hire
1995
2001
1998
2001
or (eliminating the duplicates in the identical rows) produces
Year Of Hire
1995
2001
1998
would depend on exactly how this hypothetical informal command language was
implemented.
Combination of the Relational Select and Project Operators
More powerful still is the combination of the Select and Project operators. Suppose
we apply them serially, with the relation that results from one operation being used
as the input to the next operation. For example, to retrieve the numbers and names
of the salespersons working on a 10 % commission, we would issue:
Select
rows
from
the
SALESPERSON
relation
in
which
Commission
Percentage
10.
Project the Salesperson Number and Salesperson Name over that result.
The first command ''selects out'' the rows for salespersons 137 and 204. Then
the second command ''projects'' the salesperson numbers and names from those
two rows, resulting in:
=
Salesperson
Salesperson
Number
Name
137
Baker
204
Dickens
Search WWH ::




Custom Search