2 views

Uploaded by Kartik Aneja

SQL

save

- SQL Access
- Informatics Practices MS
- ADBMS test1
- GeoMedia SQL Server Spatial User Guide_06.01.00
- XII-Informatics_Practices_MS_2018-19.doc
- O2DDL DW
- Adbt Journal Kaustubh (1)
- Oracle Final
- Les09
- tryryryText
- SQL Queries
- MySQL Database Administration
- SQL Server Questionnaire-I
- New Text Document
- Java.awt.Geom.misc
- Emergency Resource Management and Coordination
- Oracle Faqs
- Database Management Systems
- PL SQL Practicals
- TutorialMARTE-Final Version1 1 0
- ASIRef
- DATABASE MANAGEMENT SYSTEM
- Verbal & Non-Verbal Reasoning by R. S. Aggarwal(IMAGE SCAN).pdf
- DIGITAL COMMUNICATION TWO MARKS Q&A
- comm_ch06_signalspace_en.pdf
- Transport Layer Protocols and Congestion and Its Control-Quality of Services
- Routing Algorithms
- Routing Algorithms
- Functional Dependencies
- JDBC
- The Intel Microprocessor Barry b Brey.pdf
- The Intel Microprocessor Barry b Brey.pdf
- Modern Digital and Analog Communications Systems - Third Edition - B P Lathi
- 193097508-Signals-and-Systems-2nd-Edition-1996-Alan-v-Oppenheim-Alan-S-Willsky-S-Hamid-Nawab-Solutions-Manual.pdf
- Transport Layer Protocols and Congestion and Its Control-Quality of Services
- Edc Lab Manual Final
- Signals and System - Stanley Chan
- Signals and System - Stanley Chan
- Dbms Manual
- ans3ed-oddonly
- hw1
- Online Quiz
- SQLQuery1
- Infocube -Star Schema
- dbms 100 mcq.pdf
- Database Lab Questions on Views
- SQL-Multiple Choice Question
- Invocie
- DBMS (1)
- exercises
- Functional Dependencies
- 2360_ER1
- Data base of Railways Reservation System in India
- DBMS-II
- Oracle examples
- DBMS Question 1
- anna univ 2marks dbms
- DBMS
- Cs403-Finalterm Solved Mcqs With References by Moaaz
- SQL Modified
- Baza de date Produse
- Dbms Assignment
- SQL for Access
- SQL
- Dbms Lab Programs
- Oracle SQL
- SQL Queries With Answers
- 06-Unit6

You are on page 1of 30

Functional Dependence

In a relation including attribute A and B, B is

functional dependent on A if, for every valid

occurrence, the value A determines the value B

If B is ‘Functional Dependent on’ A, then A ‘is the

determinant of B’

All fields are functionally dependent on the primary key –

or indeed any candidate key – be definition.

Example: Functional Dependency

Examples loan-number amount loan-number branch-name loan-number customer-name loan-info branch-nm loan-no cust-nm amount Perryridge L-001 Peter Yeung 100000 Perryridge L-001 David Chan 100000 Perryridge L-001 May Chan 100000 Wanchai L-002 Leon Lai 100000 .

Functional Dependency Compound Determinants: If more than one attribute is necessary to determine another attribute in an entity. line#) qty A002 002 20 800 (Order#. Example: order# line# qty price Full Functional Dependencies A001 001 10 200 A002 001 20 400 (Order#. Full Functional Dependency: Only of relevance with composite determinants. This is the situation when it is necessary to use all the attributes of the composite determinant to identify its object uniquely. then such a determinant is termed a composite determinant. line#) price A004 001 15 300 .

unit#) grade 9900100 A01 TH224 2 9900010 A01 TH224 14 9901011 A02 JS075 3 Partial Functional Dependencies 9900001 A01 TH224 16 unit# room Repetition of data! . Functional Dependency Partial Functional Dependency: This is the situation that exists if it is necessary to only use a subset of the attributes of the composite determinant to identify its object uniquely. Example: Full Functional Dependencies student# unit# room grade (student#.

PLOCATION} Employee SSN and project number determines the hours per week that the employee works on the project {SSN.Examples of FD constraints Social Security Number determines employee name SSN ENAME Project Number determines project name and location PNUMBER {PNAME. PNUMBER} HOURS .

length is nontrivial but not completely nontrivial. Trivial Dependencies • A functional dependency A1A2…AnB is said to be trivial if B is one of A’s. year year . . – For example: title. • Thus title. – Completely nontrivial if none of the B’s is also one of the A’s. year title is a trivial dependency. • We say that a dependency A1A2…AnB1B2…Bm is: – Trivial if the B’s are subset of A’s. – Nontrivial if at least one of the B’s is not among the A’s.

a candidate key is always a determinant. .Keys A functional dependency allows us to express constraints that uniquely identify the values of certain attributes. but a determinant doesn’t need to be a key. Whereas a key is a set of attributes that uniquely identifies an entire tuple. However.

The closure of F (usually written as F+) is the set of all functional dependencies that may be logically derived from F. the closure.Closure Let a relation R have some functional dependencies F specified. F+. Often F is the set of most obvious and important functional dependencies. is the set of all the functional dependencies including F and those that can be deduced from F. .

. There are six rules (axioms).Axioms To determine closure of the relation we need to learn some rules. using these RULES all possible functional dependencies may be derived. Developed by Armstrong in 1974.

3. then X Z holds. then WX WY holds. each subset of X is functionally dependent on X. then X Y holds.Armstrong’s Axioms 1. Reflexivity Rule : If X is a set of attributes and Y is a subset of X. . 2. Transitivity Rule : If X Y and Y Z holds. Augmentation Rule : If X Y holds and W is a set of attributes.

Union Rule : If X Y and X Z holds. 5. then so do X Y and X Z.Derived Theorems from Armstrong’s Axioms 4. then X YZ holds. Decomposition Rule : If X YZ holds. 6. Pseudotransitivity Rule : If X Y and WY Z hold then so does WX Z. .

amount amount if X Y. branch-name amount. then X Y (reflexivity) loan-no loan-no loan-no. amount loan-no loan-no. then X Z (transitivity) loan-no branch-name (given) branch-name branch-city (given) loan-no branch-city .Examples of Armstrong’s Axioms We can find all of F+ by applying : if Y X. branch-name if X Y and Y Z . then WX WY (augmentation) loan-no amount (given) loan-no.

G.Example: Closure of set F of functional dependencies R = (A. to get AG CG and then transitivity with CG I CG HI from CG H and CG I : “union rule” . B. H. I) F= { AB AC GIVEN CG H CG I BH } Find Closure of F: some members of F + AH by transitivity from A B and B H AG I by augmenting A C with G. C.

etc. E). D → D. BD → D. transitive) Also. A →BC CD →E B→ D E→ A Solution: A → BC. C. B. we have (reflexive) A → ABCDE from the above steps (union) Since E → A. . A → E (union. BC → ABCDE (augmentative. Example: Compute the closure of the following set F of functional dependencies for relation schema R = (A. (decomposition) A → B and B → D A → D (transitive) A → CD and CD → E. decomposition. C → C. we can conclude: A → B and A → C. D. transitive) A → A. CD → ABCDE (transitive) Since B → D and BC → CD. E → ABCDE (transitive) Since CD → E.

and the number of attributes is finite. but C is not.Algorithm • Starting with the given set of attributes. 3 Repeat step 2 as many times as necessary until no more attributes can be added to X. eventually nothing more can be added to X. An}. 4 The set X after no more attributes can be added to it is the: {A1. . A2. We then add C to X. An}+. First we initialize X to be {A1. repeatedly expand the set by adding the right sides of FD’s as soon as we have included their left sides. • Eventually. we cannot expand the set any more. A2. 1 Let X be a set of attributes that eventually will become the closure. 2 Now. …. repeatedly search for some FD in S: B1B2…BmC such that all of B’s are in the set X. …. Computing the Closure of Attributes . Since X can only grow. and the Xing set is the closure.

B. X ABC X ABCD (UNION) – X = {A. CFB. X C X ABC (UNION) – X = {A. • The FD: CFB cannot be used because its left side is never contained in X.D} Use: DE ABCD ACDE (Augment ABC) X ABCE (Transitivity) X ABCDE (UNION) – X = {A.D. DE.C} Since: BCAD ABC AD (Augment A) Since: X ABC. ABC AD X AD (Transitivity) X AD.B.B}+? ABC. . BCAD.• What is {A.C. ABC X C (Transitivity) Since : X AB.B}+.B.B} Since: X AB .C.E} No more changes to X are possible so X = {A. Solution: – X = {A.

Given this FD for this R(A.C.F) AB C AD E BD AFB Check if AB+ is a key for this relation? AB+ is key if AB+ can find all the attribute of R Solution: ABAB BD so B AB AB+ABD ADE so AD ABDAB+ABDE ABC so AB ABDE AB+ABCDE AFB so AF Not ABDE AB+ABCDE AB not a key because it does not contain all attributes such as F .E.D. Example QUES.B.

I) F={ AB AC CG H CG I B H} (AG) + ? 1. G. H. X = AG 2. It is a super key. C. YES. X = ABCGH (CG H and CG AGBC) 4. 2. (G+) = G. (A+) = BC. X = ABCGHI (CG I and CG AGBCH Is (AG) a candidate key ? 1. B. X = ABCG (A C and A B) 3. .Example R = (A.

Computing the Closure of Attributes (Continued) • Example. Consider the previous example. Initially we have X={D}.E}.E} = {A.C. we have reached the closure. On the other hand consider testing the FD: DA.D.B}+. Suppose we want to test whether ABD follows from the set of the dependencies. – Concluding DA does not follow from the given set of dependencies. – First compute {D}+.E} and A {D}+. Yes! Since D{A. .B. But here we are stuck. – So {D}+ = {D. Then we can use the given DE and X becomes {D.

if G+ subset-of F+) F and G are equivalent if F covers G and G covers F There is an algorithm for checking equivalence of sets of FDs .Equivalence of Sets of FDs Two sets of FDs F and G are equivalent if: Every FD in F can be inferred from G.e. F and G are equivalent if F+ =G+ Definition (Covers): F covers G if every FD in G can be inferred from F (i.. and Every FD in G can be inferred from F Hence.

Example: R(ABC) F= { A B. G+ Calculate F G+ Calculate G F+ . B A. A C} First find closure F+ . B C. C A} G={C B.

Example F=(ABC.CDE} G={ABCE. C D E } Find if F and G are equivalent? G ‘= {A BCDE} Find if F and G’ are equivalent? . AD. A A B D.

2.Minimal Sets of FDs A set of FDs is minimal if it satisfies the following conditions: 1. 3. . We cannot replace any dependency X -> A in F with a dependency Y -> A. We cannot remove any dependency from F and have a set of dependencies that is equivalent to F. where Y proper-subset-of X ( Y subset-of X) and still have a set of dependencies that is equivalent to F. Every dependency in F has a single attribute for its RHS.

“Extraneous”: Are there any attributes in A or B that can be safely removed ? Without changing the closure implied by F Example: Given F = {A C. AB C} B is extraneous in AB C since AB C can be inferred even after deleting B . A B.Extraneous Attributes Consider F. and a functional dependency.

g. B C. A CD} can be simplified to {A B. B C. B C. AC D} can be simplified to {A B.g. B C. on LHS: {A B. B C. A D} . A C} Parts of a functional dependency may be redundant E. A D} E.Minimal Means: No redundant functional dependencies! Sets of functional dependencies may have redundant dependencies that can be inferred from the others Eg: A C is redundant in: {A B. on RHS: {A B.

H. E A} .E D} STEP 1: SINGLE ATTRIBUTE ON R.C B.EXAMPLE: R(ABCDE) F{ A D . E A.S STEP 2: NO EXTRANEOUS ATTRIBUTE ON L. BC AD .H.S STEP 3: ELIMINATE REDUNDANT FDs Final Minimal Set: { A D. C B.C A.

ACDF→E. ABCD→E. ABCD→E.Algorithms Example: {A→B. ACDF→EG} Make RHS a single attribute: {A→B. ACDF→G} Minimize LHS: ACD→E instead of ABCD→E Eliminate redundant FDs Can ACDF→G be removed? Can ACDF→E be removed? Final answer: {A→B. ACD→E. EF→GH. EF→H. EF→G. EF→H} . EF→G.

B C. A B. AB C} ? { A C. AB C} Is A is extraneous in AB C {A B. B C. B C. B C. AB C} Yes Set is now {A B. B C} . AB C} ? {A B. B C} Yes Set is now {A B. B C} The canonical cover is: {A B.Example R = (A. B C. AB C} NO Is C extraneous in A BC {A BC. AB C} ? {A B. C) F = {A BC. B. B C. AB C} Is B extraneous in A BC {A BC. B C.AB C} Combine A BC and A B into A BC Set is now {A BC. B C. B C.

- SQL AccessUploaded byJohn Williams
- Informatics Practices MSUploaded byNaman
- ADBMS test1Uploaded byBharath M Bharath
- GeoMedia SQL Server Spatial User Guide_06.01.00Uploaded byNimas Hayu Merlina Anggarini
- XII-Informatics_Practices_MS_2018-19.docUploaded byamaver1
- O2DDL DWUploaded byArima Prabu
- Adbt Journal Kaustubh (1)Uploaded bykakadeaashish
- Oracle FinalUploaded byDaniel Anghel
- Les09Uploaded byonmcv
- tryryryTextUploaded bytest
- SQL QueriesUploaded byAbhijeet Bhaskar
- MySQL Database AdministrationUploaded bygopinathkarangula
- SQL Server Questionnaire-IUploaded byapi-3761704
- New Text DocumentUploaded byzahir kh
- Java.awt.Geom.miscUploaded byKeyur Golani
- Emergency Resource Management and CoordinationUploaded byDogan Kaya
- Oracle FaqsUploaded byLakshmanan Venugopal
- Database Management SystemsUploaded byGangaa Shelvi
- PL SQL PracticalsUploaded bySelvaraj V
- TutorialMARTE-Final Version1 1 0Uploaded byJoão Taborda
- ASIRefUploaded byvenuram
- DATABASE MANAGEMENT SYSTEMUploaded bySoham Adhikari

- Verbal & Non-Verbal Reasoning by R. S. Aggarwal(IMAGE SCAN).pdfUploaded byKartik Aneja
- DIGITAL COMMUNICATION TWO MARKS Q&AUploaded byshankar
- comm_ch06_signalspace_en.pdfUploaded byKartik Aneja
- Transport Layer Protocols and Congestion and Its Control-Quality of ServicesUploaded byKartik Aneja
- Routing AlgorithmsUploaded byKartik Aneja
- Routing AlgorithmsUploaded byKartik Aneja
- Functional DependenciesUploaded byKartik Aneja
- JDBCUploaded byKartik Aneja
- The Intel Microprocessor Barry b Brey.pdfUploaded byKuludip Kumar Gupta
- The Intel Microprocessor Barry b Brey.pdfUploaded byKuludip Kumar Gupta
- Modern Digital and Analog Communications Systems - Third Edition - B P LathiUploaded byKartik Aneja
- 193097508-Signals-and-Systems-2nd-Edition-1996-Alan-v-Oppenheim-Alan-S-Willsky-S-Hamid-Nawab-Solutions-Manual.pdfUploaded byUrvashi Shukla
- Transport Layer Protocols and Congestion and Its Control-Quality of ServicesUploaded byKartik Aneja
- Edc Lab Manual FinalUploaded byKartik Aneja
- Signals and System - Stanley ChanUploaded byEEM Ders Notları
- Signals and System - Stanley ChanUploaded byEEM Ders Notları

- Dbms ManualUploaded bySumit Jain
- ans3ed-oddonlyUploaded byapi-241418009
- hw1Uploaded byLindi
- Online QuizUploaded byKen Le
- SQLQuery1Uploaded bySwarnajeet Gaekwad
- Infocube -Star SchemaUploaded byadinathavi
- dbms 100 mcq.pdfUploaded bySelvaraj Villy
- Database Lab Questions on ViewsUploaded byHrisav Bhowmick
- SQL-Multiple Choice QuestionUploaded byHalawati Chemeh
- InvocieUploaded byAbdul Ghaffar
- DBMS (1)Uploaded bySavita Kumari
- exercisesUploaded bySayatbek Orazbekov
- Functional DependenciesUploaded byKartik Aneja
- 2360_ER1Uploaded byrafael_a
- Data base of Railways Reservation System in IndiaUploaded bysummitz
- DBMS-IIUploaded bySiddharth Dwivedi
- Oracle examplesUploaded byAndrei
- DBMS Question 1Uploaded bysurya
- anna univ 2marks dbmsUploaded byMithun Mohan
- DBMSUploaded byNilesh Patel
- Cs403-Finalterm Solved Mcqs With References by MoaazUploaded bybilaltarar
- SQL ModifiedUploaded byRaJu SinGh
- Baza de date ProduseUploaded byCriss
- Dbms AssignmentUploaded byAkshada Kaphale
- SQL for AccessUploaded byKamloi Chin-Tung
- SQLUploaded byKIRAN
- Dbms Lab ProgramsUploaded bysbalajisathya
- Oracle SQLUploaded bybhanu_billa
- SQL Queries With AnswersUploaded byBalaa
- 06-Unit6Uploaded bygaardi