Functional Dependencies(Cont.) Functional dependencies allow us to express constraints that cannot be expressed using superkeys.(函教依赖使我们可 以表示不能用超玛表示的约柬) Consider the schema: Loan-info-schema=(customer-name, loan-number branch-name, amount) We expect this set of functional dependencies to hold oan- number→ amount loan-number> branch-name but would not expect the following to hold loan-number> customer-name 标 Database System Concepts 7.11 @Silberschatz, Korth and Sudarshan
Database System Concepts 7.11 ©Silberschatz, Korth and Sudarshan Functional Dependencies (Cont.) Functional dependencies allow us to express constraints that cannot be expressed using superkeys. (函数依赖使我们可 以表示不能用超玛表示的约束) Consider the schema: Loan-info-schema = (customer-name, loan-number, branch-name, amount). We expect this set of functional dependencies to hold: loan-number → amount loan-number → branch-name but would not expect the following to hold: loan-number → customer-name
Use of Functional Dependencies le use functional dependencies to test relations to see if they are legal under a given set of functional dependencies.(用于判定关糸是否在给定 函教依赖集上合法) If a relation r is legal under a set F of functional dependencies, we say that r satisfies F. specify constraints on the set of legal relations(用于指 明合法关糸集上的约束) We say that F holds on R if all legal relations on R satisfy the set of functional dependencies F. A B C D a1 b1 c1 d a1 b2 c1 d2 A→C,C+A a2 b2 C2 d2 a2 b2 c2 d3 a3. b3 2d4 Database System Concepts Osilberschatz, Korth and Sudarshan
Database System Concepts 7.12 ©Silberschatz, Korth and Sudarshan Use of Functional Dependencies We use functional dependencies to: test relations to see if they are legal under a given set of functional dependencies. (用于判定关系是否在给定 函数依赖集上合法) If a relation r is legal under a set F of functional dependencies, we say that r satisfies F. specify constraints on the set of legal relations(用于指 明合法关系集上的约束) We say that F holds on R if all legal relations on R satisfy the set of functional dependencies F. A→ C, C→A A B C D a1 b1 c1 d1 a1 b2 c1 d2 a2 b2 c2 d2 a2 b2 c2 d3 a3 b3 c2 d4
Functional Dependencies(Cont.) A functional dependency is trivial(平凡的) if it is satisfied by all instances of a relation E. g customer-name. loan-number> customer- name customer-name> customer-name In general,a→>β is trivial if Bc o 标 Database System Concepts 7.13 @Silberschatz, Korth and Sudarshan
Database System Concepts 7.13 ©Silberschatz, Korth and Sudarshan Functional Dependencies (Cont.) A functional dependency is trivial(平凡的) if it is satisfied by all instances of a relation E.g. customer-name, loan-number → customername customer-name → customer-name In general, → is trivial if
The customer Relation customer-name customer-street customer-ci ones M ain Harrison Smith North Rye Hayes Main Harrison Curry North R Li ind sa y ar」 Pittsfield Turner Putnam Stamford Williams N assau Princeton Adams Spring Pittsfield ohnson Alma Palo alto Glenn and hil Woodside Brooks Senator Brooklyn Green Walnut Stamford Customer-name >customer-city? Customer-street >customer-city? Database System Concepts 7.14 @Silberschatz, Korth and Sudarshan
Database System Concepts 7.14 ©Silberschatz, Korth and Sudarshan The customer Relation Customer-name→customer-city? Customer-street→customer-city?
The loan relation loan-number branch-name amount L-17 Downtown1000 23 Redwood 2000 L-15 Perrvridge 1500 L-14 Downtown 1500 L93 Mianus 500 Round hill 900 Pownal 1200 L-16 North Town 1300 L-18 Downtown 2000 L-25 Perryridge 2500 L-10 Brighton 2200 Loan- number→ amount? Loan-number branch-name? 标 Database System Concepts 7.15 @Silberschatz, Korth and Sudarshan
Database System Concepts 7.15 ©Silberschatz, Korth and Sudarshan The loan Relation Loan-number→amount? Loan-number→branch-name?