A Normalisation Example

Slides:



Advertisements
Similar presentations
Normalisation.
Advertisements

RJP/RDA 1 /93 Relational Data Analysis (RDA) RDA organises all the system’s data items into a set of well NORMALISED relations. These should avoid: 1.
GCSE Computing#BristolMet Session Objectives# 21 MUST describe methods of validating data as it is input. SHOULD explain the use of key fields to connect.
Normalisation Ensuring data integrity in database design 1.
Athabasca University Under Development for COMP 200 Gary Novokowsky
Maintenance Modifying the data –Add records –Delete records –Update records Modifying the design –Add fields into tables –Remove fields from a table –Change.
Boyce-Codd Normal Form Kelvin Nishikawa SE157a-03 Fall 2006 Kelvin Nishikawa SE157a-03 Fall 2006.
Table design screen Field name Data type Field size Other properties.
WELL-DESIGNED DATABASES Process faster Easy to develop and maintain Easy to read and write code.
Relational Data Analysis II. Plan Introduction Structured Methods –Data Flow Modelling –Data Modelling –Relational Data Analysis Feasibility Maintenance.
Project and Data Management Software
Database Software Application
Database Architecture The Relational Database Model.
Define Table Relationships—1 of 3 One of the most powerful features of a relational database management system, such as Access, is its ability to define.
LESSON 17 PREPARED BY MANJU. database A database is a collection of related information Access is the Microsoft Office database program that enables you.
Introduction to Schema Refinement
The Relational Database Model CST272. Return Creating the Unnormalized Table n List the fields n Select a primary key – The field (or concatenation of.
Module Title? DBMS E-R Model to Relational Model.
VCE IT Theory Slideshows
CREATE THE DIFFERENCE Normalisation (special thanks to Janet Francis for this presentation)
1 Lesson 22 Getting Started with Access Essentials Computer Literacy BASICS: A Comprehensive Guide to IC 3, 3 rd Edition Morrison / Wells.
Learningcomputer.com SQL Server 2008 – Entity Relationships in a Database.
RELATIONSHIPS Generally there are two main database types: flat-file and relational.
DBSQL 3-1 Copyright © Genetic Computer School 2009 Chapter 3 Relational Database Model.
Avoiding Database Anomalies
Normalization A technique that organizes data attributes (or fields) such that they are grouped to form stable, flexible and adaptive entities.
A Normalisation Example Mark Kelly McKinnon Secondary College Vceit.com Based on work by Robert Timmer-Arends.
Normalization (Codd, 1972) Practical Information For Real World Database Design.
Copyright Ó Oracle Corporation, All rights reserved. Normalization Use the student note section below for further explanation of the slide content.Use.
Normalisation Rules and Practical Application Geoff Leese January 2010.
CORE 2: Information systems and Databases NORMALISING DATABASES.
1 What is database 2? What is normalization? What is SQL? What is transaction?
DAY 12: DATABASE CONCEPT Tazin Afrin September 26,
Database Beginnings. Scenario so far In our scenario we have people registering for training sessions. –The data about the training sessions was placed.
MS Access. Access is a DBMS/RDMS DBMS = Database Management System RDMS = Relational Database Management System.
1 Transforming the Data Model into Relations (Tables) and Normalisation Students.
M1G Introduction to Database Development 4. Improving the database design.
Access Review. Access Access is a database application A database is a collection of records and files organized for a particular purpose Access supports.
Database Design – Lecture 8
WDM3304 week 6 Table Joins. Primary keys, foreign keys Primary key: A field of a table designated to provide a unique identifier for a specific row of.
Relational Theory and Design
Quiz questions. 1 A data structure that is made up of fields and records? Table.
Planning & Creating a Database By Ms. Naira Microsoft Access.
Microsoft Access Database Creation and Management.
Understand Primary, Foreign, and Composite Keys Database Administration Fundamentals LESSON 4.2.
* Database is a group of related objects * Objects can be Tables, Forms, Queries or Reports * All data reside in Tables * A Row in a Table is a record.
Postgresql East Philadelphia, PA Databases – A Historical Perspective.
Howard Paul. Sequential Access Index Files and Data File Random Access.
Microsoft Access 2010 Chapter 11 Database Design.
Databases Database Normalisation. Learning Objectives Design simple relational databases to the third normal form (3NF).
FEN Introduction to the database field: The development process Seminar: Introduction to relational databases Development process: Analyse.
NormalisationNormalisation Normalization is the technique of organizing data elements into records. Normalization is the technique of organizing data elements.
NORMALIZATION Handout - 4 DBMS. What is Normalization? The process of grouping data elements into tables in a way that simplifies retrieval, reduces data.
When you open Access you can open or import an existing.csv file. Check that it recognises that the fields are separated by commas.
What Is Normalization  In relational database design, the process of organizing data to minimize redundancy  Usually involves dividing a database into.
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.
Decision Analysis Fall Term 2015 Marymount University School of Business Administration Professor Suydam Week 10 Access Basics – Tutorial B; Introduction.
Flat file and relational databases Flat file database In a flat file database information is held in a single table. Student IDStudent name GenderDOBCourse.
Dr Gordon Russell, Napier University Normalisation 1 - V2.0 1 Normalisation 1 Unit 3.1.
Component 2 5A-F.
Database Design The Relational Model Text Ch5
Relational Model and ER Model: in a Nutshell
Examples of normalization
Chapter 4.1 V3.0 Napier University Dr Gordon Russell
Examples of normalization
Unit 18 Database Design Extended Diploma in ICT Julie Hodsdon
Database Normalisation
ICT Database Lesson 2 Designing a Database.
Databases 1.
Normalisation 1 Unit 3.1 Dr Gordon Russell, Napier University
Presentation transcript:

A Normalisation Example Mark Kelly McKinnon Secondary College Vceit.com Based on work by Robert Timmer-Arends

Thanks This example is based on “Relational Databases – a simplified account” by Robert Timmer-Arends

Take the following table. StudentID is the primary key. Is it 1NF?

No. There are repeating groups (subject, subjectcost, grade) How can you make it 1NF?

Create new rows so each cell contains only one value But now look – is the studentID primary key still valid?

No – the studentID no longer uniquely identifies each row You now need to declare studentID and subject together to uniquely identify each row. So the new key is StudentID and Subject.

So. We now have 1NF. Is it 2NF?

But they are not dependent on Subject (the other part of the key) Studentname and address are dependent on studentID (which is part of the key) This is good. But they are not dependent on Subject (the other part of the key)

And 2NF requires… All non-key fields are dependent on the ENTIRE key (studentID + subject)

So it’s not 2NF How can we fix it?

Make new tables Make a new table for each primary key field Give each new table its own primary key Move columns from the original table to the new table that matches their primary key…

Step 1 STUDENT TABLE (key = StudentID)

Step 2 STUDENT TABLE (key = StudentID) SUBJECTS TABLE (key = Subject)

Step 3 STUDENT TABLE (key = StudentID) SUBJECTS TABLE (key = Subject) RESULTS TABLE (key = StudentID+Subject)

Step 3 STUDENT TABLE (key = StudentID) SUBJECTS TABLE (key = Subject) RESULTS TABLE (key = StudentID+Subject)

Step 4 - relationships STUDENT TABLE (key = StudentID) SUBJECTS TABLE (key = Subject) RESULTS TABLE (key = StudentID+Subject)

Step 4 - cardinality STUDENT TABLE (key = StudentID) 1 Each student can only appear ONCE in the student table SUBJECTS TABLE (key = Subject) RESULTS TABLE (key = StudentID+Subject)

Step 4 - cardinality STUDENT TABLE (key = StudentID) 1 SUBJECTS TABLE (key = Subject) 1 Each subject can only appear ONCE in the subjects table RESULTS TABLE (key = StudentID+Subject)

Step 4 - cardinality STUDENT TABLE (key = StudentID) 1 SUBJECTS TABLE (key = Subject) 1 A subject can be listed MANY times in the results table (for different students) 8 RESULTS TABLE (key = StudentID+Subject)

Step 4 - cardinality STUDENT TABLE (key = StudentID) 1 SUBJECTS TABLE (key = Subject) 1 A student can be listed MANY times in the results table (for different subjects) 8 8 RESULTS TABLE (key = StudentID+Subject)

SubjectCost is only dependent on the primary key, A 2NF check STUDENT TABLE (key = StudentID) 1 SUBJECTS TABLE (key = Subject) 1 SubjectCost is only dependent on the primary key, Subject 8 8 RESULTS TABLE (key = StudentID+Subject)

Grade is only dependent on the primary key (studentID + subject) A 2NF check STUDENT TABLE (key = StudentID) 1 SUBJECTS TABLE (key = Subject) 1 8 8 Grade is only dependent on the primary key (studentID + subject) RESULTS TABLE (key = StudentID+Subject)

Name, Address are only dependent on the primary key A 2NF check STUDENT TABLE (key = StudentID) 1 Name, Address are only dependent on the primary key (StudentID) SUBJECTS TABLE (key = Subject) 1 8 8 RESULTS TABLE (key = StudentID+Subject)

So it is 2NF! But is it 3NF? STUDENT TABLE (key = StudentID) 1 SUBJECTS TABLE (key = Subject) 1 8 8 But is it 3NF? RESULTS TABLE (key = StudentID+Subject)

Oh oh… A 3NF check What? STUDENT TABLE (key = StudentID) 1 SUBJECTS TABLE (key = Subject) 1 8 8 RESULTS TABLE (key = StudentID+Subject)

HouseName is dependent on both StudentID + HouseColour A 3NF check STUDENT TABLE (key = StudentID) 1 HouseName is dependent on both StudentID + HouseColour SUBJECTS TABLE (key = Subject) 1 8 8 RESULTS TABLE (key = StudentID+Subject)

Or HouseColour is dependent on both StudentID + HouseName A 3NF check STUDENT TABLE (key = StudentID) 1 Or HouseColour is dependent on both StudentID + HouseName SUBJECTS TABLE (key = Subject) 1 8 8 RESULTS TABLE (key = StudentID+Subject)

non-key fields are dependent on MORE THAN THE PRIMARY KEY (studentID) A 3NF check STUDENT TABLE (key = StudentID) 1 But either way, non-key fields are dependent on MORE THAN THE PRIMARY KEY (studentID) SUBJECTS TABLE (key = Subject) 1 8 8 RESULTS TABLE (key = StudentID+Subject)

And 3NF says that non-key fields must depend on nothing but the key A 3NF check STUDENT TABLE (key = StudentID) 1 And 3NF says that non-key fields must depend on nothing but the key SUBJECTS TABLE (key = Subject) 1 8 8 RESULTS TABLE (key = StudentID+Subject)

WHAT DO WE DO? A 3NF check STUDENT TABLE (key = StudentID) 1 SUBJECTS TABLE (key = Subject) 1 8 8 RESULTS TABLE (key = StudentID+Subject)

Again, carve off the offending fields 1 SUBJECTS TABLE (key = Subject) 8 8 1 RESULTS TABLE (key = StudentID+Subject)

A 3NF fix 1 SUBJECTS TABLE (key = Subject) 8 8 1 RESULTS TABLE (key = StudentID+Subject)

A 3NF fix 8 1 1 SUBJECTS TABLE (key = Subject) 8 8 1 RESULTS TABLE (key = StudentID+Subject)

A 3NF win! Or… 1 8 SUBJECTS TABLE (key = Subject) RESULTS TABLE (key = StudentID+Subject) 1 8 Or…

The Reveal Before… After… 1 8 1 1 8 8 SUBJECTS TABLE (key = Subject) RESULTS TABLE (key = StudentID+Subject)

The end Thanks to Robert Timmer-Arends for the scenario and staging of the normalisation Mark Kelly Vceit.com