tailieunhanh - Applied Mathematics for Database Professionals phần 5

Nó nói rằng không có nhân viên có thể kiếm được hơn 1 / 5 ngân sách tiền lương các phòng ban (phòng nơi ông làm việc). Một cách chính thức quy định cụ thể này là như sau: Trong đề xuất này, t biểu thức (sal) ≤ t (salbudget) / 5 đại diện cho một vị tuple buộc tuples trong tham gia. Mô hình này có tính chất thường được tìm thấy trong các thiết kế cơ sở dữ liệu và được gọi là một vị tuple trong tham gia | 136 CHAPTER 6 TUPLE TABLE AND DATABASE PREDICATES It states that no employee can earn more than a fifth of the departmental salary budget of the department where he or she is employed . Another way of formally specifying this is as follows VteEMP1 DEP1 t sal t salbudget 5 In this proposition the expression t sal t salbudget 5 represents a tuple predicate that constrains the tuples in the join. This predicate pattern is commonly found in database designs and is referred to as a tuple-in-join predicate. Definition 6-4 formally specifies it. Definition 6-4 Tuple-in-Join Predicate Let T1 and T2 be tables and P a tuple predicate. A predicate is a tuple-in-join predicate if it is of the following form VteT1 T2 P t We say that P constrains tuples in the join of T1 and T2. In the preceding definition you will typically find that tables T1 and T2 are related via a subset requirement that involves the join attributes. Listing 6-11 demonstrates two more instantiations of a tuple-in-join predicate involving tables EMP1 and DEP1. Listing 6-11 . More Tuple-in-Join Predicates Regarding Tables EMP1 and DEP1 P9 VeeEMP1 VdeDEP1 eị deptno dị deptno d loc LOS aNgELES e job MANAGER P10 VeeEMP1 VdeDEP1 eị deptno dị deptno d loc SAN FrAnCiScO e job e TRAINER CLERK P9 states that managers cannot be employed in Los Angeles. P10 states that employees working in San Francisco must either be trainers or clerks. Given the sample values EMP1 and DEP1 in Figure 6-10 both propositions are TRUE there are no managers working in Los Angeles and all employees working in San Francisco there are none are either trainers or clerks. In this section we ve defined the tuple-in-join predicate to involve only two tables. However it is often meaningful to combine three or even more tables with the join operator. Of course tuples in these joins can also be constrained by a tuple predicate. Here is the pattern of a tuple-in-join predicate involving three tables T1 T2 and T3 Vt1eT1 Vt2eT2 Vt3eT3 t1lA t2lA Ù t2lB