Sei sulla pagina 1di 1

84 Part 2 Design Concepts

FIGURE 3.5 PROJECT


Original table New table

PROJECT PRICE yields

PROJECT P_DESCRIPT and PRICE yields

PROJECT P_CODE and PRICE yields

Note
Formally, PROJECT is denoted by the Greek letter pi (π). Some sources use the uppercase
letter, and other sources use the lowercase letter. Codd used the lowercase π in his origi-
nal article on the relational model, and that is what we use here. Pi is followed by the list
of attributes to be returned as subscripts, and then the relation listed in parentheses. For
example, to PROJECT the CUS_FNAME and CUS_LNAME attributes in the CUSTOMER
table, you would write the following:
πcus_fname, cus_lname (customer)

UNION Since relational operators have the property of closure, that is, they accept relations as
In relational algebra, an input and produce relations as output, it is possible to combine operators. For example,
operator used to merge you can combine the two previous operators to find the customer first and last name of
(append) two tables into the customer with customer code 10010:
a new table, dropping
πcus_fname, cus_lname (σcus_code = 10010 (customer))
the duplicate rows. The
tables must be union-
compatible.
union-compatible
Two or more tables that Union UNION combines all rows from two tables, excluding duplicate rows. To be used in the
have the same number UNION, the tables must have the same attribute characteristics; in other words, the columns
of columns and the and domains must be compatible. When two or more tables share the same number of col-
corresponding columns umns, and when their corresponding columns share the same or compatible domains, they are
have compatible domains.
said to be union-compatible. The effect of a UNION operation is shown in Figure 3.6.

FIGURE 3.6 UNION


UNION yields

Copyright 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.

Potrebbero piacerti anche