Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management.

Similar presentations


Presentation on theme: "1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management."— Presentation transcript:

1 1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Session 7 Designing a Database (Part 3 – Normalization) ITE 252 Database Management

2 2 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Normalizing Data Data normalization: Methodology for organizing attributes into tables to eliminate redundancy among non-key attributes Goals: – Each resultant table describes single entity type or single many-to-many relationship – Foreign keys appear exactly where needed – Properly structured relational database

3 3 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Normalization Techniques Two types of input needed for data normalization process 1.List of all attributes to be incorporated in database, including intersection data attributes 2.List of functional dependencies: all defining associations between attributes In functional dependencies, one attribute (determinate attribute – left side) defines value of another attribute – functionally dependent on the left side Salesperson Number → Salesperson Name

4 4 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Example: Converting M-M Binary Relationship

5 5 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Entity Attributes Assume the salespersons are organized into departments and that each department has a manger who is not herself a sales person We get this list of attributes…

6 6 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Salesperson Entity Attributes

7 7 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Salesperson Entity Functional Dependencies (Defining Associations)

8 8 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Example: Defining Attributes and Functional Dependencies Quantity is defined by two combined attributes Manager is defined independently by two attributes – Department Number and Salesperson Number Salesperson Number also defines Department Number

9 9 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Normalizing Data Normal forms: Rules for data normalization Three main normal forms – First normal form – Second normal form – Third normal form Normalization: – Uses normal forms to step through “decomposition process” that decomposes attributes into subgroups In third normal form, group of tables is well-structured relational database with no data redundancy Goal: no data redundancy

10 10 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Normalizing Data First normal form: – Eliminates multiple values Second normal form: – Eliminates partial functional dependencies (data dependent on part of primary key) – Every nonkey attribute must be fully functionally dependent on entire key of table Third normal form: – Eliminates transitive dependencies (one nonkey attribute is functionally dependent on another) – Nonkey attributes are not allowed to define other nonkey attributes

11 11 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Example: Unnormalized Data multiple values

12 12 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management First Normal Form multiple values

13 13 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Second Normal Form eliminated partial functional dependencies (See figure 4-29 in text; some redundant data)

14 14 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Third Normal Form (See figure 4-31 in text; notice DEPARTMENT table)

15 15 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Denormalizing Data Denormalizing may be needed when: – Normalization has been taken to extreme Too many small tables creating more work and storage space – E.g. Using State table to be referenced instead of entering two-digit code) – More efficient data retrieval is needed: Many queries requiring resource-intensive joining In denormalizing, you join two or more tables into one less normalized table

16 16 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Summary In converting E-R diagrams to relational tables, each entity typically converted into table, with attributes as table columns. Considerations in conversion: Business needs, cardinalities, modalities, and defining foreign keys to establish relationships. Normalization: Uses three main normal forms to step through “decomposing” attributes into subgroups that allow data redundancies to be eliminated. Denormalizing may be needed in cases where storage space and speed of data retrieval are important factors.

17 17 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Key Terms Data normalization - A methodology for organizing attributes into tables so that redundancy among the nonkey attributes is eliminated Decomposition process - Another term for the data normalization process. Also called “non-loss decomposition” Determinant attribute - The attribute in a defining association whose value determines the value of the attribute on the right side of the association Exception conditions - Less commonly used normal forms First normal form - Each attribute value is atomic, that is, no attribute is multivalued Functional dependency - See Defining association

18 18 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Key Terms Joining - Combining the data from two tables based on linking columns Non-loss decomposition - Normalization process in which neither data nor relationships are lost Normal forms - Defined rules for data normalization Partial functional dependency - A dependency where data is dependent on part of the primary key Second normal form - Every nonkey attribute must be fully functionally dependent on the entire key Third normal form (3NF) - Transitive dependencies are not allowed Transitive dependency - One nonkey attribute is functionally dependent

19 19 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q&A The usual goal in normalization is normalizing to the third normal form. True or False?

20 20 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q&A The usual goal in normalization is normalizing to the third normal form. True or False?

21 21 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q&A What statement best describes the second normal form? a)Each attribute value is atomic, that is, no attribute is multivalued. b)Transitive dependencies are not allowed. c)Every nonkey attribute must be fully functionally dependent on the entire key

22 22 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q&A What statement best describes the second normal form? a)Each attribute value is atomic, that is, no attribute is multivalued. b)Transitive dependencies are not allowed. c)Every nonkey attribute must be fully functionally dependent on the entire key

23 23 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q&A If tables are in the second normal form, they may or may not also be in the first normal form. True or False?

24 24 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q&A If tables are in the second normal form, they may or may not also be in the first normal form. True or False?

25 25 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q&A Which normal form works to eliminate partial functional dependencies? a)first b)second c)third d)fourth

26 26 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q&A Which normal form works to eliminate partial functional dependencies? a)first b)second c)third d)fourth

27 27 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q&A Which term is used to refer to the value on the left in the following association? Salesperson number → Salesperson name a)independent attribute b)associative attribute c)dependent attribute d)determinant attribute

28 28 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q&A Which term is used to refer to the value on the left in the following association? Salesperson number → Salesperson name a)independent attribute b)associative attribute c)dependent attribute d)determinant attribute

29 29 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q&A In normalization, what is an exception condition? a)normalization forms beyond the three standard normal forms b)data that cannot be normalized c)the requirement to add a table to support relationships d)a table that is self-normalizing

30 30 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q&A In normalization, what is an exception condition? a)normalization forms beyond the three standard normal forms b)data that cannot be normalized c)the requirement to add a table to support relationships d)a table that is self-normalizing

31 31 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q&A Combining data from different normalized tables into a query result is referred to as joining. True or False?

32 32 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q&A Combining data from different normalized tables into a query result is referred to as joining. True or False?

33 33 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Important Links Database Normalization - good description from Wikipedia Database Normalization An Introduction to Database Normalization – if you can get past the computerized female voice, it’s a pretty good overview An Introduction to Database Normalization Database Normalizaion Basics – Microsoft Overview Database Normalizaion Basics

34 34 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Homework HW#2: In HW#1 you create an E-R diagram modeled after the Good Reading Bookstores E-R diagram (Figure 3-19 in your text and slide 14 here) for a publisher of music (limit to MP3s). Now apply the normalization technique for all three forms, building tables similar to Figure 4-30 and 4-31 in your text on pages 132-133. Due next Monday


Download ppt "1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management."

Similar presentations


Ads by Google