# Introduction to Database System--Finding the minimum function dependency set

Source: Internet
Author: User
Tags terminates

Definition: If the function dependency set F satisfies the following conditions, F is called the minimum function dependency set or the minimum overwrite.

The right part of any function that is dependent on the ①f contains only one property;
There is not such a function dependent x→a in ②f, which makes F and f-{x→a} equivalent;
③f does not exist in a function dependent x→a,x has a true subset Z makes f-{x→a}∪{z→a} and F equivalent.

or expressed as:

Minimum dependency set: If the function set F satisfies the following three conditions:
The right part of each function dependency in ①f is a single attribute;
Any function in ②f is dependent on x→a, and its f-{x→a} and F are not equivalent;
Any function in the ③f relies on x→a,z as a subset of X. (F-{x→a}∪{z→a} and F are not equal prices.) Then the f is called the minimum function dependency set, which is recorded as Fmin.

Algorithm: Calculates the minimum function dependency set.

Enter a function dependency set

An equivalent minimum function-dependent set g of output F

Step: ① uses the law of decomposition to make any function in F dependent on the right part containing only one attribute;
② removes excess function dependencies: Starting from the first function relies on x→y to remove it from the F, and then in the rest of the function depends on the closure of X x+, see if x+ contains Y, if, then remove x→y; Until the redundant function dependencies are not found;
③ Remove the dependencies on the left part of the property. One by one checks that the function relies on the left part of a property that is not single. For example Xy→a, if Y is redundant, then substituting x→a for xy→a is equivalent. If a belongs to (x) +, then y is an extra attribute and can be removed.

For example: Known relational schema R<u,f>,u={a,b,c,d,e,g},f={ab→c,d→eg,c→a,be→c,bc→d,cg→bd,acd→b,ce→ag}, the minimum function dependency set for f is obtained.

Solution 1: Use the algorithm to solve, make it meet three conditions

① uses the decomposition rule to turn all function dependencies into a function dependency of a single property on the right, F: f={ab→c,d→e,d→g,c→a,be→c,bc→d,cg→b,cg→d,acd→b,ce→a,ce→g}

② Remove excess function dependencies in F

A Set Ab→c as redundant function dependencies, then remove Ab→c, get: F1={d→e,d→g,c→a,be→c,bc→d,cg→b,cg→d,acd→b,ce→a,ce→g}

Calculation (AB) f1+: Set X (0) =ab

Calculates x (1): Scans the function dependencies in the F1, finds the function dependencies of the left part AB or AB, because such a function dependency cannot be found. So there is x (1) =x (0) =ab, and the algorithm terminates.

(AB) f1+= AB does not contain C, so ab→c is not a redundant function dependency and cannot be removed from the F1.

b Set Cg→b as redundant function dependencies, then remove Cg→b, get: F2={ab→c,d→e,d→g,c→a,be→c,bc→d,cg→d,acd→b,ce→a,ce→g}

Computing (CG) f2+: Set X (0) =CG

Compute x (1): Scan F2 function dependencies, find the left part of the CG or CG subset of functional dependencies, get a c→a function dependency. So there is x (1) =x (0) ∪A=CGA=ACG.

Compute x (2): Scan the function dependencies in the F2, find the function dependencies of the left part ACG or ACG subset, and get a cg→d function dependency. So there is X (2) =x (1) ∪d=acdg.

Compute x (3): Scan the function dependencies in the F2, find the function dependencies of the left part of the ACDG or ACDG subset, and get two acd→b and d→e function dependencies. So there is x (3) =x (2) ∪be=abcdeg, because X (3) =u, the algorithm terminates.

(CG) f2+=abcdeg contains B, so cg→b is a redundant function dependency, removed from the F2.

C Set Cg→d as redundant function dependencies, then remove Cg→d, get: F3={ab→c,d→e,d→g,c→a,be→c,bc→d,acd→b,ce→a,ce→g}

Computing (CG) f3+: Set X (0) =CG

Compute x (1): Scan F3 function dependencies, find the left part of the CG or CG subset of functional dependencies, get a c→a function dependency. So there is x (1) =x (0) ∪A=CGA=ACG.

Computes X (2): Scans the function dependencies in the F3, finds the function dependencies of the left part of the ACG or ACG subset, because such a function dependency cannot be found. So there is X (2) =x (1), and the algorithm terminates. (CG) F3+=ACG.

(CG) F3+=ACG does not contain D, so cg→d is not a redundant function dependency and cannot be removed from the F3.

D Set Ce→a as redundant function dependencies, then remove Ce→a, get: F4={ab→c,d→e,d→g,c→a,be→c,bc→d,cg→d,acd→b,ce→g}

Computing (CG) f4+: Set X (0) =ce

Compute x (1): Scan F4 function dependencies, find the left part of the CE or CE subset of functional dependencies, get a c→a function dependency. So there is x (1) =x (0) ∪a=cea=ace.

Compute x (2): Scan F4 function dependencies, find the left part of the Ace or ace subset of functional dependencies, get a ce→g function dependency. So there is X (2) =x (1) ∪g=aceg.

Compute x (3): Scan the function dependencies in the F4, find the function dependencies of the left part Aceg or ACEG subset, and get a cg→d function dependency. So there is x (3) =x (2) ∪d=acdeg.

Compute x (4): Scan the function dependencies in the F4, find the function dependencies of the left part acdeg or acdeg subset, and get a acd→b function dependency. So there is x (4) =x (3) ∪b=abcdeg. Because X (4) =u, the algorithm terminates.

(CE) f4+=abcdeg contains a, so ce→a is a redundant function dependency, removed from the F4.

③ remove the extra attributes in the F4 that depend on the left (only function dependencies on the left is not a single property) due to C→a, the function relies on the attribute a in acd→b to be redundant and remove a to cd→b.

So the minimum function dependency set is: F={ab→c,d→e,d→g,c→a,be→c,bc→d,cg→d,cd→b,ce→g}

Related Keywords:

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.