Question

In: Computer Science

I'm not clear with decompose to 3NF for database. Can someone explain to me with example...

I'm not clear with decompose to 3NF for database. Can someone explain to me with example please?

Solutions

Expert Solution

Decomposition of a Relation Schema -

If a relation is not in a desired normal form, it can be decomposed into multiple relations that each are in that normal form.

Suppose that relation R contains attributes A1 ... An. A decomposition of R consists of replacing R by two or more relations such that: Each new relation scheme contains a subset of the attributes of R, and Every attribute of R appears as an attribute of at least one of the new relations.

Normalization Using Functional Dependencies-

When we decompose a relation schema R with a set of functional dependencies F into R1, R 2,.., R n we want -

1.Lossless-join Decomposition (complete reproduction)

2. No Redundancy (BCNF or 3NF)  

3. Dependency Preservation.

Lossless-join Decomposition--

All attributes of an original schema (R) must appear in the decomposition ( R1, R 2): R = R1 ∪ R 2

For all possible relations Ri on schema R

R = ∏ R1 ( R) natural join ∏R2 ( R)

We Want to be able to reconstruct big (e.g. universal) relation by joining smaller ones (using natural joins) (i.e. R1 natural join R2 = R)

Testing for Lossless-Join Decomposition -

Rule: A decomposition of R into (R1, R2) is lossless, iff: R1 ∩ R2 =key( R1 )or R1 ∩ R2 =key( R2) in F+.

Lossless- Example: Lossless-join Decomposition

R = {A,B,C,D,E}. F = {A →BC, CD →E, B → D, E →A }. Is the following decomposition a lossless join?

1. R1 = {A,B,C}, R2 ={A,D,E} Since R1 ∩ R2 = A , and A is a key for R 1 , the decomposition is lossless join.

2. R1 = {A,B,C}, R2 ={C,D,E} Since R1 ∩ R2 = C, and C is not a key for R1 or R2, the decomposition is not lossless join.

Dependency Preserving Decomposition -

The decomposition of a relation scheme R with FDs F is a set of tables (fragments) Ri with FDs Fi

Fi is the subset of dependencies in F+ (the closure of F) that include only attributes in Ri.

The decomposition is dependency preserving iff (∪ i F i)+ = F+ .

In other words: we want to minimize the cost of global integrity constraints based on FD’s ( i.e. avoid big joins in assertions) ( F 1 ∪ F2 ∪ … ∪ Fn ) + = F + (F+ = closure of F).

Third Normal Form Decomposition-

Third Normal Form 3NF: A schema R is in third normal form (3NF) if for all FD α → β in F +, at least one of the following holds:

(1) α → β is trivial (i.e., β ⊆ α).

( 2 ) α is a superkey superkey for R.

(3)Each attribute A in β – α is contained in a candidate key for R (prime).

The decomposition is both lossless-join and dependency-preserving.

Third Normal Form -

A relational schema R is in 3NF if for every FD X → A associated with R either: A ⊆ X (i.e., the FD is trivial) or X is a superkey of R or A is part of some key (not just superkey!) 3NF weaker than BCNF (every schema that is in BCNF is also in 3NF).

Third Normal Form

Compromise - Not all redundancy removed, but dependency-preserving decompositions are always possible

3NF decomposition is based on the concept of minimal cover of a set of FDs.

Decomposition---

(1) Eliminate redundant FDs, resulting in a canonical cover Fc of F

(2) Create a relation Ri = XY for each FD X → Y in Fc

(3) If the key K of R does not occur in any relation Ri, create one more relation Ri=K

Example

R =(A, B, C, D). F = {C→D, C→A, B→C}.

Decompose R into a set of 3NF relations.

The canonical cover is Fc = {C→DA, B→C}. For each functional dependency in Fc we create a table: R1 = {C, D, A}, R2 = {B, C}. The table R2 contains the candidate key for R – we done.


Related Solutions

Hi I'm having a hard time understand this can someone please explain it to me? Thank...
Hi I'm having a hard time understand this can someone please explain it to me? Thank you. Cholesterol is a type of fat found in the blood. It is measured as a concentration: the number of milligrams of cholesterol found per deciliter of blood (mg/dL). A high level of total cholesterol in the bloodstream increases risk for heart disease. For this problem, assume cholesterol in men and women follows a normal distribution, and that “adult man” and “adult woman” refers...
Can someone give me an example an non example of coefficient?
Can someone give me an example an non example of coefficient?
Can someone clear up these confusions re the eye and vision for me? - When a...
Can someone clear up these confusions re the eye and vision for me? - When a virtual image is formed through the use of artificial lens (glasses) does this means that simultaneously a real image is formed on the retina? Or is it that it is possible to see some images with the aid of lens by bypassing the retina? - On the principal axis, why is the 'far point' of a person suffering from hyperopia considered negative?
Can someone explain REM rebound to me? For example, is it true that after 5 hours...
Can someone explain REM rebound to me? For example, is it true that after 5 hours or so, we enter our longest REM period? Can you also include a somnogram sketch to illustrate? Thanks!
Can someone verify for me that I'm doing this correctly? For data analysis, part b: All...
Can someone verify for me that I'm doing this correctly? For data analysis, part b: All S2O32- is consumed at the end of the reaction. Therefore, the moles of S2O32- consumed can be calculated using the equation below. (moles S2O32-)consumed = Mstock x (Vstock) My instructor states "The stock sodium thiosulfate (S2O3) is 0.01M 0.01M x 0.010 L = 0.0001moles S2O3" So I did the rest of this accordingly (below), and it differs a lot from what's on this website....
Can someone please tell me if these calculations are correct! I'm reviewing my notes, and my...
Can someone please tell me if these calculations are correct! I'm reviewing my notes, and my professor said to always multiply the lipids by 3 and then divide by 7 to get the total amount of cals of lipids per day... I'm not completely sure why you do that? Can someone explain. Why don't you just stop at 700 cals for lipids? 1. Calculate the number of calories and grams protein for the following TPN solution: D50W in 500cc 10%...
I'm honestly not 100% sure what's going on here. Can someone post an example? This is...
I'm honestly not 100% sure what's going on here. Can someone post an example? This is for C++/Databases Deliverable You must upload to moodle a single .zip archive file of your site folder. Use a utility that produces .zip files (Windows: right click | Send to | compress, Mac: right click | compress). Objectives To design, code and publish a database driven web site of your choosing. Project setup • Using VS Code, create the folder project. This folder is...
can someone explain to me the problems that can arise in the world of aggregate capacity...
can someone explain to me the problems that can arise in the world of aggregate capacity planning and how we solve it ??? ( I need a length and easy to read answer with examples )
can someone tell me why I'm getting the error code on Eclipse IDE: Error: Main method...
can someone tell me why I'm getting the error code on Eclipse IDE: Error: Main method is not static in class StaticInitializationBlock, please define the main method as:    public static void main(String[] args) This is what I'm working on class A { static int i; static { System.out.println(1); i = 100; } } public class StaticInitializationBlock { static { System.out.println(2); } public static void main(String[] args) { System.out.println(3); System.out.println(A.i); } }
Can someone explain to me the concept of composite DSSC solar panel?
Can someone explain to me the concept of composite DSSC solar panel?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT