Presentation is loading. Please wait.

Presentation is loading. Please wait.

Review of Week 3 Relation Transforming ERD into Relations

Similar presentations


Presentation on theme: "Review of Week 3 Relation Transforming ERD into Relations"— Presentation transcript:

1 Review of Week 3 Relation Transforming ERD into Relations
Map entity Map relationship: 1-1, 1-M, M-N Functional dependency Primary key definition Partial Transitive Database Management Systems

2 Module 2 Database Design Concepts

3 Chapter 5 Normalization of Database Tables
Module 2: Database Design Concepts

4 Normalization Process for evaluating and improving table structures to minimize data redundancies Process of decomposing relations with anomalies to produce smaller, well-structured relations 1NF 2NF 3NF Database Management Systems

5 Well Structured Relations
A well structured relation contains minimal redundancy and allows users to insert, modify and delete the rows in a table without errors or inconsistencies. General rule of thumb: a relation should not pertain to more than one entity Database Management Systems

6 Data Anomalies Redundancies or anomalies are errors or inconsistencies that may result when a user attempts to update a table that contains redundant data. There are three types: Insertion anomaly: adding new rows forces user to create duplicate data Deletion anomaly: deleting rows may cause a loss of data that would be needed for other future rows Update anomaly: changing data in a row forces changes to other rows because of duplication Database Management Systems

7 A Table in the Report Format
Database Management Systems

8 Examples of Data Anomalies
Insertion anomaly: a new project or a new employee Deletion anomaly: remove a project or an employee Update anomaly: modify Job_class for employee 105 (many alterations), or 103 (lost information on Elec. Engineer) Database Management Systems

9 Conversion to 1NF Relational database design is required to be in first normal form (1NF) Three steps Database Management Systems

10 Step 1: Eliminate the Repeating Groups
Present data in a tabular format, where each cell has a single value and there are no repeating groups Eliminate repeating groups by eliminating nulls, making sure that each repeating group attribute contains an appropriate data value Database Management Systems

11 Data Organization: Step 1
Database Management Systems

12 Step 2: Identify Primary Key
Primary key must uniquely identify attribute value New key must be composed Database Management Systems

13 Step 3: Identify all Dependencies
Dependency diagram: Depicts all dependencies found within a given table structure Helpful in getting bird’s-eye view of all relationships among a table’s attributes Makes it much less likely that an important dependency will be overlooked Database Management Systems

14 A Dependency Diagram: First Normal Form (1NF)
Database Management Systems

15 First Normal Form Tabular format in which:
All key attributes are defined There are no repeating groups in the table All attributes are dependent on primary key All relational tables satisfy 1NF requirements Some tables contain partial dependencies Dependencies based on only part of the primary key Sometimes used for performance reasons, but should be used with caution Still subject to data redundancies Database Management Systems

16 Conversion to 2NF Relational database design can be improved by converting the database into second normal form (2NF) Two steps Database Management Systems

17 Step 1: Identify All Key Components
Write each key component on separate line, and then write the original (composite) key on the last line Each component will become the key in a new table Database Management Systems

18 Step 2: Identify the Dependent Attributes
Determine which attributes are dependent on which other attributes At this point, most anomalies have been eliminated Database Management Systems

19 Second Normal Form (2NF) Conversion Results
Database Management Systems

20 Second Normal Form Table is in second normal form (2NF) if:
It is in 1NF and It includes no partial dependencies: No attribute is dependent on only a portion of the primary key Database Management Systems

21 Conversion to 3NF Data anomalies created are easily eliminated by completing three steps Database Management Systems

22 Step 1: Identify Each New Determinant
For every transitive dependency, write its determinant as a PK for a new table Determinant Any attribute whose value determines other values within a row Database Management Systems

23 Step 2: Identify the Dependent Attributes
Identify the attributes dependent on each determinant identified in Step 1 and identify the dependency Name the table to reflect its contents and function Database Management Systems

24 Step 3: Remove Transitive Dependencies
Eliminate all dependent attributes in transitive dependencies from each table that has such a transitive relationship Draw a new dependency diagram to show all tables defined in Steps 1–3 Check new tables and modified tables from Step 3 to make sure that each has a determinant and does not contain inappropriate dependencies Database Management Systems

25 Third Normal Form (3NF) Conversion Results
Database Management Systems

26 Third Normal Form A table is in third normal form (3NF) if:
It is in 2NF and It contains no transitive dependencies Database Management Systems

27 Improving the Design Table structures are cleaned up to eliminate the troublesome initial partial and transitive dependencies Normalization cannot, by itself, be relied on to make good designs It is valuable because its use helps eliminate data redundancies Database Management Systems

28 The Completed Database
Database Management Systems

29 The Completed Database (cont’d)
Database Management Systems

30 Activity Table P5.11 on Page 216 Database Management Systems

31 Normalization and Data Design
Normalization should be part of design process Make sure that proposed entities meet required normal form before table structures are created Many real-world databases have been improperly designed or burdened with anomalies if improperly modified during course of time Database Management Systems

32 Normalization and Data Design (continued)
ER diagram Provides the big picture, or macro view, of an organization’s data requirements and operations Created through an iterative process Identifying relevant entities, their attributes and their relationship Use results to identify additional entities and attributes Database Management Systems

33 Normalization and Data Design (continued)
Normalization procedures Focus on the characteristics of specific entities A micro view of the entities within the ER diagram Difficult to separate normalization process from ER modeling process Two techniques should be used concurrently Database Management Systems

34 The Initial ERD Database Management Systems

35 The Modified ERD Database Management Systems

36 The Final ERD Database Management Systems

37 Higher-Level Normal Forms
BCNF 4NF 5NF Database Management Systems

38 Denormalization Creation of normalized relations is important database design goal Processing requirements should also be a goal If tables decomposed to conform to normalization requirements Number of database tables expands Database Management Systems

39 Denormalization (continued)
Joining larger number of tables takes additional disk input/output (I/O) operations and processing logic Reduces system speed Conflicts among design efficiency, information requirements, and processing speed are often resolved through compromises that may include denormalization Database Management Systems

40 Denormalization (continued)
Use denormalization cautiously Understand why—under some circumstances—unnormalized tables are a better choice Database Management Systems

41 Wrap Up Review course website Assignment 4-1 Assignment 4-2
Assignment 4-1 Use the table P5.15 on page 217 as the initial relation, and normalize it to 3NF Assignment 4-2 In assignment4-2.doc Database Management Systems


Download ppt "Review of Week 3 Relation Transforming ERD into Relations"

Similar presentations


Ads by Google