Download presentation
Presentation is loading. Please wait.
Published byHannah Houston Modified over 9 years ago
1
Daniel AdinugrohoDatabase Programming 1 DATABASE PROGRAMMING Lecture on 04 – 05 – 2005
2
Daniel AdinugrohoDatabase Programming 2 PREVIOUS LECTURE 1. Introduction to Database Design - 6 Steps Database Design 2. Normalization. - 1NF, 2NF and 3NF and example of normalization. - BCNF, 4NF and 5NF
3
Daniel AdinugrohoDatabase Programming 3 NEWS 1. All lecture materials are available on http://192.168.1.1/teachers/adinugro/dp 2. Next Lecture will be QUIZ (06/05/2005) - About Normalization - OPEN BOOK - DO NOT CHEAT!!!!!!!!!! or You will get 0. - Exercise for exam, as the question is a typical exam questions, - OK?
4
Daniel AdinugrohoDatabase Programming 4 REVIEW OF NORMAL FORMS 1NF -> eliminate repeating attributes 1. Identify repeating attributes. 2. All the key attributes are defined. 3. All attributes are dependent on the primary key. 2NF 1. It's in first normal form (1NF) 2. It includes no partial dependencies (where an attribute is dependent on only a part of a primary key). 3NF 1. It's in second normal form (2NF) 2. It contains no transitive dependencies (where a non-key attribute is dependent on another non-key attribute
5
Daniel AdinugrohoDatabase Programming 5
6
Daniel AdinugrohoDatabase Programming 6 1 st NORMAL FORM
7
Daniel AdinugrohoDatabase Programming 7 2 nd NORMAL FORM Employee Table
8
Daniel AdinugrohoDatabase Programming 8 2 nd NORMAL FORM Project TableEmployee Project Table
9
Daniel AdinugrohoDatabase Programming 9 3 rd NORMAL FORM Employee TableRate Table
10
Daniel AdinugrohoDatabase Programming 10 3 rd NORMAL FORM Project TableEmployee Project Table
11
Daniel AdinugrohoDatabase Programming 11 DENORMALIZATION Normalization is: ● Storing one fact in one place ● Storing related facts about single entity together ● every column of each entity refers non-transitively to only the unique identifier for that entity. Denormalization: is the reversal process of Normalization, which is a process to store a fact in numerous places.
12
Daniel AdinugrohoDatabase Programming 12 DENORMALIZATION(2) Sometimes we need to do denormalization to accomplish quick retrieval capability for data stored in relational database. Of course we should (whenever possible) normalize our design to provide optimum environment. However, in real world, denormalization is necessary. Some issues need to be considered before denormalization: ● can the system achieve acceptable performance without denormalizating? ● will the performance of the system after denormalizating still unacceptable? ● will the system be less reliable due to denormalization? If there is one 'yes' answer, we should avoid denormalization!
13
Daniel AdinugrohoDatabase Programming 13 DENORMALIZATION (EXAMPLE) In order to justify denormalization we need to have a business reason for the alteration form 3rd NF. This example design is for a mail order company that has 120,000,000 customers to whom they must send catalogs. The top design is in 3rd normal form because the attributes for State, City, and Country are codependent on the PostalCode field. To fix that we created the PostalCode entity and related it back to the Customer records on the PostalCode foreign key in the Customer table. However, during system testing it was discovered that the time required to produce 120,000,000 mailing labels through a two-table join was much longer than if the labels could be produced from a single table. The table was then denormalized by reintroducing the City, State, and Country attributes to the Customer table. After doing this it would be heavily documented including the normal form that is violated, the reason for the violation, and the consequences of the violation. Any violation of a fully normalized design carries with it potential problems in the area of updates.
14
Daniel AdinugrohoDatabase Programming 14 REFERENCES ● Craig, S. Mullin, Denormalization, http://www.objectarchitects.de/ObjectArchitects/orpatterns/Performance/Denormali zation/CraigMullinsGuidelines/i001fe02.htm ● Ian Gilfillan, Database Normalization, http://www.databasejournal.com/sqletc/article.php/1428511 http://www.databasejournal.com/sqletc/article.php/1428511 ● Mike Hillyer, An Introduction to Database Normalization, http://dev.mysql.com/tech-resources/articles/intro-to-normalization.html http://dev.mysql.com/tech-resources/articles/intro-to-normalization.html ● David Faour, Database Normalization, http://www.serverwatch.com/tutorials/article.php/1549781
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.