Download presentation
Presentation is loading. Please wait.
Published byDelilah Miller Modified over 9 years ago
1
Data Analysis Improving Database Design
2
Normalization The process of transforming a data model into a flexible, stable structure. Reduces anomalies Anomaly – An unintended negative consequence of changing the contents of the data.
3
Anomalies 100Swimming50 150Skiing200 Dance50 250Swimming50 300Skiing200 SIDActivityFee
4
Functional Dependency A relationship between attributes such that if the value of one attribute is known, the value of another attribute can be determined. In a database including social security numbers and names, given the value of SSN the value of Name can be determined. SSN Name SSN functional determines Name Name is functionally dependent on SSN SSN is the determinant of Name
5
Functional Dependency (cont.) May exist among groups of attributes. 100Accounting 101A 150Finance 101B 100Marketing 101B 200Accounting 101B 150Marketing 101A SIDClassGrade Functional Dependency: (SID, Class) Grade
6
Keys A key is an attribute or group of attributes that uniquely identifies a row in a table. If a key is a group of attributes, it is called a composite key. A key functionally determines the entire row. Often called the primary key.
7
Uniqueness Keys must be unique in a table. Determinants may or may not be unique in a table. 100Jones Hall200 150Trevor Hall300 200Smith Hall500 250Jones Hall200 300Smith Hall500 SIDDormRent
8
Normal Forms Classifications of tables based on the types of anomalies to which they are vulnerable. There are currently 7 normal forms (1NF, 2NF, 3NF, etc.) Each normal form eliminates a particular type of anomaly. Normal forms are cumulative.
9
First Normal Form (1NF) A table is in 1NF if: Every cell contains a single value (no repeating groups or arrays) Each column has a unique name All values in a column are of the same kind The order of the columns is insignificant Every row is unique The order of the rows is insignificant
10
1NF Example Emp_ID Emp_FName Emp_LName Emp_Phone Emp_DepName EMPLOYEE Employee has multiple phone numbers. Employee has multiple Dependents.
11
1NF Example Solution Emp_ID Emp_FName Emp_LName Emp_OfficePhone Emp_HomePhone Emp_CellPhone EMPLOYEE Emp_ID Emp_DepName DEPENDENT
12
Second Normal Form (2NF) A table is in 2NF if it is in 1NF and it has no partial dependencies. 2NF is only a concern if a table has a composite key. A partial dependency is when a non- key attribute is functionally dependent on only part of a composite key.
13
2NF Example 100Swimming50Beginner 150Skiing200Advanced 200Dance50Beginner 150Swimming50Intermediate 200Skiing200Intermediate SIDActivityFee Recreation(SID, Activity, Fee, Expertise) Key: (SID, Activity) Functional Dependency: Activity Fee Expertise
14
2NF Example solution 100SwimmingBeginner 150SkiingAdvanced 200DanceBeginner 150SwimmingIntermediate 200SkiingIntermediate SIDActivity Fee Expertise Dance50 Skiing200 Swimming50 Activity
15
Third Normal Form (3NF) A table is in 3NF if it is in 2NF and has no transitive dependencies. A transitive dependency is when one non-key attribute determines another non-key attribute.
16
3NF Example 100Jones Hall200 150Trevor Hall300 200Smith Hall500 250Jones Hall200 300Smith Hall500 SIDDormRent Housing(SID, Dorm, Rent) Key: SID Functional Dependency: Dorm Rent
17
3NF Example solution 100Jones Hall 150Trevor Hall 200Smith Hall 250Jones Hall 300Smith Hall SIDDorm Rent Jones Hall200 Smith Hall500 Trevor Hall300 Dorm
18
Boyce-Codd Normal Form (BCNF) Special form of 3NF A table is in BCNF if it is in 3NF and every determinant is a candidate key. Arises when a non-key attribute determines part of a composite key.
19
BCNF Example SIDMajorAdvisor 101AccountingSmith 101CISJones 102ManagementJohnson 103CISLewis 103MarketingThomas 104CISJones A student can have many majors. A student has a different advisor for each major. Each advisor advises for only one major.
20
BCNF Example SIDMajorAdvisor 101AccountingSmith 101CISJones 102ManagementJohnson 103CISLewis 103MarketingThomas 104CISJones Advising (SID, Major, Advisor) Candidate Keys: (SID, Major) or (SID, Advisor) Functional Dependency: Advisor Major
21
BCNF Solution SIDAdvisor 101Smith 101Jones 102Johnson 103Lewis 103Thomas 104Jones AdvisorMajor SmithAccounting JonesCIS JohnsonManagement LewisCIS ThomasMarketing
22
Fourth Normal Form (4NF) A table is in 4NF if it is in BCNF and has no multivalued dependencies (MVDs). A multivalued dependency exists when one attribute determines multiple values for two or more other attributes that are independent of each other.
23
4NF Example SIDMajorActivity 101AccountingSwimming 101CISSwimming 102ManagementSkiing 102ManagementDance 103CISHiking 103MarketingHiking 104CISSkiing
24
4NF Solution SIDActivity 101Swimming 102Dance 102Skiing 103Hiking 104Skiing SIDMajor 101Accounting 101CIS 102Management 103CIS 103Marketing 104CIS
25
Fifth Normal Form (5NF) A table is in 5NF if it is already in 4NF and cannot have any lossless decompositions. The table cannot be represented by a set of smaller tables that can reconstruct the original table. Also called Projection-Join Normal Form (PJNF) Defines a point where a table cannot be decomposed further.
26
5NF Example EmpIDProjectIDSkill 101AProgram 101BDesign 102BProgram EmpIDProjectID 101A B 102B EmpIDSkill 101Program 101Design 102Program EmpIDProjectIDSkill 101AProgram 101ADesign 101BProgram 101BDesign 102BProgram
27
5NF Example EmpIDProjectIDSkill 101AProgram 101BDesign 102BProgram EmpIDProjectID 101A B 102B EmpIDSkill 101Program 101Design 102Program EmpIDProjectIDSkill 101AProgram 101BDesign 102BProgram ProjectIDSkill AProgram BDesign BProgram
28
Domain Key Normal Form (DKNF) Theoretical structure that is free of all anomalies. “Every constraint on the database is a logical consequence of the definition of keys and domains.”
29
Denormalization Tables may be denormalized to improve performance. Normalization increases the number of tables and relationships Accessing multiple tables across relationships requires more processing than accessing a single table
30
Normalized Model Evaluate the attributes of the tables to ensure compliance with normalization rules. Create new tables as needed. Place foreign keys for new tables.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.