CREATE THE DIFFERENCE Normalisation (special thanks to Janet Francis for this presentation)

Slides:



Advertisements
Similar presentations
Normalisation.
Advertisements

Relational Terminology. Normalization A method where data items are grouped together to better accommodate business changes Provides a method for representing.
Topic Database Normalisation S McKeever Advanced Databases 1.
Normalisation Ensuring data integrity in database design 1.
Athabasca University Under Development for COMP 200 Gary Novokowsky
Normalization of Database Tables
Normalisation “A formal technique for analysing relations based on their primary key and functional dependencies.” [Codd]. Process – Analyse each relation.
Relational Data Analysis Learning outcomes  understand the process of normalisation;  perform Relational Data Analysis;  recognise the importance of.
Normalisation up to 1NF Bottom-up Approach to Data Modelling.
1 NORMALISATION. 2 Introduction Overview Objectives Intro. to Subject Why we normalise 1, 2 & 3 NF Normalisation Process Example Summary.
Normalization of Database Tables
Normalisation up to 1NF Bottom-up Approach to Data Modelling.
Relational Data Analysis II. Plan Introduction Structured Methods –Data Flow Modelling –Data Modelling –Relational Data Analysis Feasibility Maintenance.
Chapter 5 Normalization of Database Tables
Project and Data Management Software
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 5 Normalization of Database Tables.
Database – Part 2a Dr. V.T. Raja Oregon State University.
NORMALIZATION N. HARIKA (CSC).
LOGICAL DATABASE DESIGN
Mapping ERM to relational database
Week 6 Lecture Normalization
The Teacher Computing Database Design CP4 Revision.
XP Chapter 1 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Level 3 Objectives: Identifying and Eliminating Database.
Modelling Techniques - Normalisation Description and exemplification of normalisation.Description and exemplification of normalisation. Creation of un-normalised.
Data Modelling – ERD Entity Relationship Diagram’s Entity Relationship Diagrams and how to create them. 1.
Concepts and Terminology Introduction to Database.
Relational databases and third normal form As always click on speaker notes under view when executing to get more information!
Normalization A technique that organizes data attributes (or fields) such that they are grouped to form stable, flexible and adaptive entities.
Database Systems: Design, Implementation, and Management Tenth Edition
Database Systems: Design, Implementation, and Management Ninth Edition Chapter 6 Normalization of Database Tables.
Normalisation Mia’s Sandwich Shop The Process Explained.
1 DATABASE SYSTEMS DESIGN IMPLEMENTATION AND MANAGEMENT INTERNATIONAL EDITION ROB CORONEL CROCKETT Chapter 7 Normalisation.
Normalization (Codd, 1972) Practical Information For Real World Database Design.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 5 Normalization of Database.
SALINI SUDESH. Primarily a tool to validate and improve a logical design so that it satisfies certain constraints that avoid unnecessary duplication of.
CORE 2: Information systems and Databases NORMALISING DATABASES.
1 Information Retrieval and Use Data Analysis & Data Modeling, Relational Data Analysis and Logical Data Modeling Geoff Leese September 2009.
Normalization Well structured relations and anomalies Normalization First normal form (1NF) Functional dependence Partial functional dependency Second.
Unit 4 Normalisationand Relational Database Management Systems.
M1G Introduction to Database Development 4. Improving the database design.
Handling Many to Many Relationships. 2 Handling Many:Many Relationships Aims: To explain why M:M relationships cannot be implemented in relational database.
Normalization of Database Tables
Database Design Normalisation. Last Session Looked at: –What databases were –Where they are used –How they are used.
ERD Narrative (p158 Lab Manual) With Additional Notes!!
Chapter 56 Relational Database Design Compiled by Eddie Moorcroft.
Normalisation RELATIONAL DATABASES.  Last week we looked at elements of designing a database and the generation of an ERD  As part of the design and.
Flat Files Relational Databases
Normalisation 1NF to 3NF Ashima Wadhwa. In This Lecture Normalisation to 3NF Data redundancy Functional dependencies Normal forms First, Second, and Third.
Databases Database Normalisation. Learning Objectives Design simple relational databases to the third normal form (3NF).
Normalization. Overview Earliest  formalized database design technique and at one time was the starting point for logical database design. Today  is.
NormalisationNormalisation Normalization is the technique of organizing data elements into records. Normalization is the technique of organizing data elements.
IMS 4212: Normalization 1 Dr. Lawrence West, Management Dept., University of Central Florida Normalization—Topics Functional Dependency.
NORMALIZATION Handout - 4 DBMS. What is Normalization? The process of grouping data elements into tables in a way that simplifies retrieval, reduces data.
5 1 Chapter 5 Normalization of Database Tables Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
What Is Normalization  In relational database design, the process of organizing data to minimize redundancy  Usually involves dividing a database into.
MS Access. Most A2 projects use MS Access Has sufficient depth to support a significant project. Relational Databases. Fairly easy to develop a good user.
1 The Relational Data Model David J. Stucki. Relational Model Concepts 2 Fundamental concept: the relation  The Relational Model represents an entire.
Normalisation Unit 6: Databases. Just to recap  What is an Entity  What is an Attribute?
Starter Draw a mind map for topic 6 Databases. Objectives Revise topic CG3.6 Databases using various activities and ensure that topics covered are understood.
Normalisation FORM RULES 1NF 2NF 3NF. What is normalisation of data? The process of Normalisation organises your database to: Reduce or minimise redundant.
Normalisation Worked example for an Order Remember : The data should depend upon the key, the whole key and nothing but the key.
NORMALISATION OF DATABASES. WHAT IS NORMALISATION? Normalisation is used because Databases need to avoid have redundant data, which makes it inefficient.
Relational Databases – Further Study I think we’ve covered all you need to know for GCSE about relational databases I’m not aware of any practical coursework.
Flat file and relational databases Flat file database In a flat file database information is held in a single table. Student IDStudent name GenderDOBCourse.
Databases – Exam questions
Data Modelling Introduction
Entity relationship diagrams
Chapter 4.1 V3.0 Napier University Dr Gordon Russell
BTEC ICT – Unit 18 With Mr Griffiths.
Normalisation 1 Unit 3.1 Dr Gordon Russell, Napier University
Presentation transcript:

CREATE THE DIFFERENCE Normalisation (special thanks to Janet Francis for this presentation)

CREATE THE DIFFERENCE Aim To demonstrate the meaning of normalisation To demonstrate how normalisation can be used to good effect 2

CREATE THE DIFFERENCE Normalisation A process which uses a set of rules for grouping data elements into logical entities (relations) If followed carefully, it will result in a robust database design Each stage in the process results in the production of a structure - a normal form. For most purposes, the first three stages (to 3 rd normal form – 3NF) are sufficient 3

CREATE THE DIFFERENCE Un-normalised data A list of fields needed for the system Scenario –All staff are released for two hours a week for staff development. –Employees work at their own pace in a lab. –A total of six attributes are recorded about each employee including their normal office location (building and room), the date they joined the course and how many hours it is planned for them to work on it.

CREATE THE DIFFERENCE Un-normalised data Course ID Course Name Employee ID Name Building Room ID Date Joined Course Allocated Hours In this example, Course ID, Employee ID and Room ID are known to be unique.

CREATE THE DIFFERENCE Problems There is no record of the employee until they have joined a course. Lots of duplicate employee data is created once employees start to join courses.

CREATE THE DIFFERENCE First Normal Form (1NF) An entity is in 1NF if it has an identifying key and there are no repeating attributes or repeating groups of attributes To get to 1NF we must remove all repeating groups

CREATE THE DIFFERENCE Remember what we started with Course details and Employee details are repeating groups Course ID Course Name Employee ID Name Building Room ID Date Joined Course Allocated Hours

CREATE THE DIFFERENCE We need to: Take one of the unique identifiers eg. “Course ID” (we could have used Room ID or Employee ID) For each of the other attributes, check if they have a one to one relationship with “Course ID” If so, keep them, if not move them into a new entity. For the new entity, a unique identifier is required and is formed as a composite by using “Course ID” combined with another unique identifier. “Employee ID” is chosen for this example though it could have been Room ID.

CREATE THE DIFFERENCE Our Example COURSEEMP_ON_COURSE Course ID Course Name Course ID*, Employee ID Name Building Room ID Date Joined Course Allocated Hours NB: Course ID is part of the composite Primary Key of the new entity “ EMP_ON_COURSE”. It is also the Foreign Key providing a relationship with COURSE

CREATE THE DIFFERENCE Problems Still problem with employee details Not so much duplicate data – course details are now only entered once per course.

CREATE THE DIFFERENCE Second Normal Form (2NF) An entity is in 2NF if it is in 1NF and has no attributes which require only part of the key to identify them uniquely To get to 2NF we remove part key dependencies All data items must be dependant on the whole of the composite primary key

CREATE THE DIFFERENCE Not all groups are in 2NF COURSE is already in 2NF EMP_ON_COURSE is not because AttributeDepends On Name Block Room ID Date Joined Course Hours Employee ID Employee ID + Course ID

CREATE THE DIFFERENCE So we.. Take out details that are linked only to “Employee ID” into a separate entity. If in any doubt, ask a question such as ‘Are these fields affected when an Emloyee joins a course’ AttributeDepends On Name Building Room ID Employee ID

CREATE THE DIFFERENCE ….end up with three entities COURSEEMP_ON_COURSEEMPLOYEE Course ID Course Name Course ID*, Employee ID* Date Joined Course Allocated Hours Employee ID Name Building Room ID The two parts of the composite Primary key in EMP_ON_COURSE are Foreign keys in the linked tables

CREATE THE DIFFERENCE Problems No problem with courses No problem with Employees But –Building and Room Number are related in that a room is in a particular building. If one is updated the other will be affected. –If the building names change, then with the current structure the whole of the employee records currently stored will have to be updated

CREATE THE DIFFERENCE Third Normal Form (3NF) An entity is in 3NF if it is in 2NF and no non-key attribute depends on another non-key attribute. To get to 3NF we must remove attributes that depend on other non-key attributes i.e. resolve the Room and Building problem

CREATE THE DIFFERENCE We need to: Decide on the direction of the dependency between the attributes For example –If, given a value for A, there is only one possible value for B, then A determines B B is dependant on A –So for rooms at Staffordshire University, the room number is unique – we know for example that K342 is in the Octagon Building and C312 is in the Beacon Building. –If you know the room, you can find out the building - the same is not true vice-versa because if you know the Building you cannot determine the room.

CREATE THE DIFFERENCE And the solution is.. Leave Room ID in the original entity as a foreign key, but remove Building into a separate entity with Room ID as the Primary Key. EMPLOYEEROOM Employee ID Name Room ID* Room ID Building

CREATE THE DIFFERENCE Entity Relationship Modelling Course Emp_On_CourseEmployee Room This is not perfect – why – at least 3 reasons

CREATE THE DIFFERENCE To Normalise to 3NF 1. Remove all repeating data elements and ensure that everything is dependant on the Primary Key 2. Ensure data items are dependant on the whole of the composite primary key 3. Remove to new entities all fields dependant on non-key fields This process is sometimes referred to as The key, the whole key and nothing but the key!!

CREATE THE DIFFERENCE Ways to represent Normalisation To make it easier to write down –# represents a numeric field –Primary keys are underlined –Foreign keys* are in Italics with an asterisk The entities we created would be represented as: EMPLOYEE (#Employee ID,Name,#Room ID*) ROOM (#Room No, Building) COURSE (#Course ID, Course Name) EMP_ON_COURSE (#Course ID*, #Employee ID*, Date Joined Course, allocated Hours