Presentation is loading. Please wait.

Presentation is loading. Please wait.

Normalisation Rules and Practical Application Geoff Leese January 2010.

Similar presentations


Presentation on theme: "Normalisation Rules and Practical Application Geoff Leese January 2010."— Presentation transcript:

1 Normalisation Rules and Practical Application Geoff Leese January 2010

2 Normalisation and Rules of Normalisation Normalisation: the process of converting complex data structures into simple, stable data structures. First Normal From (1NF) – Unique rows, no multivalued attributes. – All relations are in 1NF. Second Normal Form (2NF) Each nonprimary key attribute is identified by the whole key (called full functional dependency). Third Normal Form (3NF) – Nonprimary key attributes do not depend on each other (i.e. no transitive dependencies). The result of normalisation is that every nonprimary key attribute depends upon the whole primary key.

3 Functional Dependencies and Primary Keys Functional Dependency – A particular relationship between two attributes. – For a given relation, attribute B is functionally dependent on attribute A if, for every valid value of A, that value of A uniquely determines the value of B. – The functional dependence of B on A is represented by A→B.

4 Functional Dependencies and Primary Keys (Cont.) Functional dependency is not a mathematical dependency. Instances (or sample data) in a relation do not prove the existence of a functional dependency. Knowledge of problem domain is most reliable method for identifying functional dependency.

5 Second Normal Form (2NF) A relation is in second normal form (2NF) if any of the following conditions apply: – Every non-primary key attribute is functionally dependent on the full set of primary key attributes. To convert a relation into 2NF, you decompose the relation into new relations using the attributes, called determinants, that determine other attributes. The determinants are the primary key of the new relation.

6 Third Normal Form (3NF) A relation is in third normal form (3NF) if it is in second normal form (2NF) and there are no functional (transitive) dependencies between two (or more) nonprimary key attributes.

7 Third Normal Form (3NF) (Cont.) Foreign Key: an attribute that appears as a non- primary key attribute in one relation and as a primary key attribute (or part of a primary key) in another relation. Referential Integrity: an integrity constraint specifying that the value (or existence) of an attribute in one relation depends on the value (or existence) of the same attribute in another relation.

8 Example stage one Student entity Student_id (primary key) Student_name Student_address Student_phone_no Student_email_address Student_course_code_one Student_course_title_one Student_course_location_one Student_course_leader_id one Student_course_leader_name_one Student_course_leader_email_one Student_course_code_two Student_course_title_two Student_course_location_two Student_course_leader_id two Student_course_leader_name_two Student_course_leader_email_two Where are the problems?

9 Example stage two Student entity Student_id (primary key) Student_surname Student_firstname Student_address_house and street Student_address_district Student_address_town Student_address_city Student_address_postcode Student_phone_no Student_email_address Course entity Student_address Student_phone_no Student_email_address Course_code Course_title Course_location Course_leader_id Course_leader_first_name Course_leader_surname Course_leader_email First Normal Form – repeating group removed to form a new entity, multi-valued attributes decomposed. Second normal form?

10 Example stage three Student entity Student_id (primary key) Student_surname Student_firstname Student_address_house and street Student_address_district Student_address_town Student_address_city Student_address_postcode Student_phone_no Student_email_address Course entity Course_code (primary key) Course_title Course_location Second Normal Form – “Course leader” set of attributes removed to form a new entity as they don’t depend on the course ID. Third normal form? Relationships? Course_Leader entity Course_ Leader_id Course_leader_first_name Course_leader_surname Course_leader_email

11 The completed ERD (LDS in SELECT SSADM language!) I’m not sure about the “address” set of attributes – are you?

12 Further reading http://askgeoff.org.uk/ITSKILLS/Presentations/ Hoffer5e_CH10.ppt - Week 20. http://askgeoff.org.uk/ITSKILLS/Presentations/ Hoffer5e_CH10.ppt - Week 20 Hoffer et al (2008), Modern Systems Analysis and Design (5 th edition) pages 352-355 http://www.youtube.com/watch?v=uO80f642 LCY http://www.youtube.com/watch?v=uO80f642 LCY – Accent grates a bit, but otherwise OK! http://www.dbnormalization.com/examples


Download ppt "Normalisation Rules and Practical Application Geoff Leese January 2010."

Similar presentations


Ads by Google