Database Reference
In-Depth Information
(B)
ASSIGNMENT
Relation
EmployeeNo
89
89
44
53
53
55
55
55
55
77
77
87
87
21
21
55
ProjectNo
1
2
3
1
2
2
3
7
8
9
7
7
9
9
8
8
(C)
JONESPROJ
Relation
(A)
JONESEMP
Relation
ProjectNo
EmployeeNo
1
89
2
53
Divide relation B by relation C
giving relation A
Figure 8-16
DIVIDE operation.
Columns of C must be a subset of columns of B.
Columns of A are all and only those columns of B that are not columns of C.
Place a row in A, if and only if it is associated with every row in C.
Data request Find all employees who worked on every project Jones had
worked on. Name the result as relation JONESEMP (see Figure 8-16).
Relational algebra solution
JONESEMP :
=
ASSIGNMENT / JONESPROJ
Note the syntax for the operation in relational algebra and the symbol / indicat-
ing divide operation. Observe how the rows for the result relation JONE-
SEMP are formed. Note that columns of JONESPROJ are a subset of columns
of relation ASSIGNMENT. Columns of the result relation JONESEMP are
all and only those columns of ASSIGNMENT that are not columns of
JONESPROJ.
Relational Calculus
This is the second generic language proposed for manipulating data in a database
conforming to the relational data model. As you have seen, relational algebra con-
sists of distinct operations. To arrive at a required solution relation, you use the
operations one after another in a specific sequence. Commercial database vendors
provide equivalent commands or statements for the relational algebra operations
in their language implementations.
Relational calculus is markedly different. Here, no separate and distinct opera-
tions exist similar to the relational algebra operations. Relational calculus expresses
a solution relation in a single statement. Database vendors implement the typical
relational calculus statement in their database languages.
Search WWH ::




Custom Search