Topic Database Normalisation S McKeever Advanced Databases 1.

Slides:



Advertisements
Similar presentations
Copyright: ©2005 by Elsevier Inc. All rights reserved. 1 Author: Graeme C. Simsion and Graham C. Witt Chapter 3 The Entity-Relationship Approach.
Advertisements

Relational Terminology. Normalization A method where data items are grouped together to better accommodate business changes Provides a method for representing.
4N and the Normalization of Multivalue Dependency By: Laith Alnagem.
Normalisation Ensuring data integrity in database design 1.
Topic Denormalisation S McKeever Advanced Databases 1.
Relational Data Analysis Learning outcomes  understand the process of normalisation;  perform Relational Data Analysis;  recognise the importance of.
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
1 NORMALISATION. 2 Introduction Overview Objectives Intro. to Subject Why we normalise 1, 2 & 3 NF Normalisation Process Example Summary.
E-COMMERCE JOBS This project (Project number: HU/01/B/F/PP ) is carried out with the financial support of the Commssion of the European Communities.
Project and Data Management Software
Page 1 ISMT E-120 Desktop Applications for Managers Introduction to Microsoft Access.
Module Title? DBMS E-R Model to Relational Model.
Chapter 4: Logical Database Design and the Relational Model (Part II)
Week 6 Lecture Normalization
Modelling Techniques - Normalisation Description and exemplification of normalisation.Description and exemplification of normalisation. Creation of un-normalised.
CREATE THE DIFFERENCE Normalisation (special thanks to Janet Francis for this presentation)
Cambridge TEC - Level 3 Certificate/Diploma IT. ICT Dept ScenarioLO1LO2LO3.
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.
Normalisation Mia’s Sandwich Shop The Process Explained.
Module III: The Normal Forms. Edgar F. Codd first proposed the process of normalization and what came to be known as the 1st normal form. The database.
Normalization (Codd, 1972) Practical Information For Real World Database Design.
Concepts of Relational Databases. Fundamental Concepts Relational data model – A data model representing data in the form of tables Relations – A 2-dimensional.
Database Normalization Lynne Weldon July 17, 2000.
SALINI SUDESH. Primarily a tool to validate and improve a logical design so that it satisfies certain constraints that avoid unnecessary duplication of.
M Taimoor Khan Course Objectives 1) Basic Concepts 2) Tools 3) Database architecture and design 4) Flow of data (DFDs)
In this chapter, you learn about the following: ❑ Anomalies ❑ Dependency and determinants ❑ Normalization ❑ A layman’s method of understanding normalization.
Chapter 7 1 Database Principles Data Normalization Primarily a tool to validate and improve a logical design so that it satisfies certain constraints that.
CORE 2: Information systems and Databases NORMALISING DATABASES.
MS Access: Creating Relational Databases Instructor: Vicki Weidler Assistant: Joaquin Obieta.
By Andrew Yee. Why 4NF? Performance – We want database to take up less space.
FEN Quality checking table design: Design Guidelines Normalisation Table Design Is this OK?
IMS 4212: Normalization 1 Dr. Lawrence West, Management Dept., University of Central Florida Normalization—Topics Functional Dependency.
Normalisation Africamuseum 5 June What is ‘Normalisation’?  Theoretical: satisfying the requirements of the different ‘Normal Forms’, as spelled.
1 5 Normalization. 2 5 Database Design Give some body of data to be represented in a database, how do we decide on a suitable logical structure for that.
Databases Shortfalls of file management systems Structure of a database Database administration Database Management system Hierarchical Databases Network.
Databases Unit 3_6. Flat File Databases One table containing data Data must be entered as a whole each time e.g. customer name and address each time (data.
M1G Introduction to Database Development 4. Improving the database design.
ITN Table Normalization1 ITN 170 MySQL Database Programming Lecture 3 :Database Analysis and Design (III) Normalization.
Programming Logic and Design Fourth Edition, Comprehensive Chapter 16 Using Relational Databases.
A337 - Reed Smith1 Structure What is a database? –Table of information Rows are referred to as records Columns are referred to as fields Record identifier.
CTFS Workshop Shameema Esufali Asian data coordinator and technical resource for the network
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
NORMALIZATION. What is Normalization  The process of effectively organizing data in a database  Two goals  To eliminate redundant data  Ensure data.
Understand Relational Database Management Systems Software Development Fundamentals LESSON 6.1.
Brian Thoms.  Databases normalization The systematic way of ensuring that a database structure is suitable for general-purpose querying and free of certain.
Logical Database Design and the Relational Model.
IST Database Normalization Todd Bacastow IST 210.
1 CS 430 Database Theory Winter 2005 Lecture 7: Designing a Database Logical Level.
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.
INFS 6220 Systems Analysis & Design Transactional DBs vs. Data Warehouses.
NORMALIZATION Handout - 4 DBMS. What is Normalization? The process of grouping data elements into tables in a way that simplifies retrieval, reduces data.
What Is Normalization  In relational database design, the process of organizing data to minimize redundancy  Usually involves dividing a database into.
©G. Millbery 2005Relational and Online Database Management SystemsSlide 1 Module Relational and Online Database Management Systems Normalisation.
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.
Lecture # 17 Chapter # 10 Normalization Database Systems.
Copyright © 2016 Pearson Education, Inc. Modern Database Management 12 th Edition Jeff Hoffer, Ramesh Venkataraman, Heikki Topi CHAPTER 4: PART C LOGICAL.
Normalisation FORM RULES 1NF 2NF 3NF. What is normalisation of data? The process of Normalisation organises your database to: Reduce or minimise redundant.
N ORMALIZATION 1. Chapter 5 R ELATION Definition: A relation is a named, two-dimensional table of data Table consists of rows (records) and columns (attribute.
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.
Revised: 2 April 2004 Fred Swartz
Chapter 5: Logical Database Design and the Relational Model
Payroll Management System
Chapter 4.1 V3.0 Napier University Dr Gordon Russell
Relational Database Model
CHAPTER 4: LOGICAL DATABASE DESIGN AND THE RELATIONAL MODEL
Normalisation 1 Unit 3.1 Dr Gordon Russell, Napier University
Presentation transcript:

Topic Database Normalisation S McKeever Advanced Databases 1

3 phases… S McKeeverAdvanced Databases 2 ConceptualLogicalPhysical Need a systematic approach to designing and building the dB

S McKeeverAdvanced Databases 3 Normalisation is a process by which data structures in a relational database are as efficient as possible, including the elimination of redundancy, the minimisation of the use of null values and the prevention of the loss of information.

S McKeever 4 Aims of Normalisation Normalisation ensures that the database is structured in the best possible way. To achieve control over data redundancy. There should be no unnecessary duplication of data in different tables. To ensure data consistency. Where duplication is necessary the data is the same. To ensure tables have a flexible structure. (e.g. number of order lines per order not limited) To make the database suitable for querying

S McKeeverdvanced Databases 5 Duplication vs Redundant Data Duplicated Data: When an attribute has two or more identical values Redundant Data: If you can delete data without a loss of information

S McKeever 6 What’s wrong with this? Student table

S McKeever 7 And this?

S McKeever 8 What about this?

S McKeever 9 Is this ok?

S McKeever 10 RestaurantPizza VarietyDelivery Area A1 PizzaThick CrustSpringfield A1 PizzaThick CrustShelbyville A1 PizzaThick CrustCapital City A1 PizzaStuffed CrustSpringfield A1 PizzaStuffed CrustShelbyville A1 PizzaStuffed CrustCapital City Elite PizzaThin CrustCapital City Elite PizzaStuffed CrustCapital City Vincenzo's PizzaThick CrustSpringfield Vincenzo's PizzaThick CrustShelbyville Vincenzo's PizzaThin CrustSpringfield Vincenzo's PizzaThin CrustShelbyville Is this ok?

S McKeever 11 There are increasing levels of normalisation S McKeever 11 1 st normal form – 1NF 2 nd normal form – 2NF.. 4th normal form 5 th normal form They’re cumulative – e.g. a database can’t be in 4 th normal form, without being in 1 st, 2 nd, 3 rd also In the real world, normalisation of databases follow a set of design steps

S McKeever 12

S McKeever 13 First Normal Form A table is in its first normal form if it contains no repeating attributes or groups of attributes

S McKeever 14 Non-Normalised Table

S McKeever 15 First Normal Form

S McKeever 16 Second Normal Form A table is in the second normal form if it's in the first normal form AND non-prime attributes are functionally dependent on the whole of every candidate key. (the values in each non primary key column can be worked out from the values in all the candidate key(s) i.e. you can’t work out the values from part of the candidate key )

S McKeever 17 EmployeeSkill Office MurphyTyping22 Barn Way MurphyCooking22 Barn way MurphyCleaning22 Barn way KeaneBasic cooking114 Rodeo drive MaguireProgramming9 Harbour view MaguireTyping9 Harvour view DoyleHardware config10 The close The values in each non primary key column can be worked out from the values in all the candidate key(s) i.e. you can’t work out the values from part of the candidate key What’s the candidate key? What are the non primary key columns? Is this in Second Normal Form

S McKeever 18 Second Normal Form The concept of functional dependency in central to normalisation and, in particular, strongly related to 2NF. Think of the word functional dependant as “can be worked out from”

S McKeever 19 Functional Dependency If ‘X’ is a set of attributes within a relation, then we say ‘A’ (an attribute or set of attributes), is functionally dependant on X, if and only if, for every combination of X, there is only one corresponding value of A We write this as : X -> A

S McKeever 20 Table in 1NF Remember what’s wrong with it? Can you work out the name, address, status from the primary key or from something else?

S McKeever 21 Functional Dependency It is clear that : RefNo -> Name, Address, Status i.e. Name, address and status are functionally dependant on Ref No OR Name address status can be worked out from Ref no… Because for every ref no there is only one name, address, status) or, most correctly, AccNo, RefNo -> Name, Address, Status

S McKeever 22 Second Normal Form

S McKeever 23 Over to you...

S McKeever 24 Table in Second Normal Form

S McKeever 25 Third Normal Form A table is in the third normal form if it is the second normal form and there are no non-key columns dependant on other non-key columns that could not act as the primary key.

S McKeever 26 Table in Second Normal Form Are there any non-key columns dependant on other non- key columns (that could not act as the primary key.)

S McKeever 27 Table in Third Normal Form

S McKeever 28 Important Papers E.F.Codd ‘A Relational Model for Large Shared Data Banks’ CACM 13(6) June 1970 E.F. Codd ‘Extending the Database Relational Model to Capture More Meaning’ ACM Transactions on Database Systems, 4(4), December 1979

S McKeever 29 Table in Third Normal Form

S McKeever 30 Redundancy in 3NF The combination of ROOM, TIME is unique to each tuple, no room is used twice at the same time -> key But, we know there is a redundancy in that ROOM depends LECTURER, therefore, we split the table...

S McKeever 31 Fourth Normal Form The 4NF removes unwanted data structures: multivalued dependencies.

S McKeever 32 Consider employees, skills, and languages, where an employee may have several skills and several languages. We have here two many-to-many relationships, one between employees and skills, and one between employees and languages. Under fourth normal form, these two relationships should not be represented in a single record such as | EMPLOYEE | SKILL | LANGUAGE | Instead, they should be represented in the two records | EMPLOYEE | SKILL | | EMPLOYEE | LANGUAGE Fourth Normal Form

In practice, do the following checks as you design, before “thinking” about normalisation S McKeeverAdvanced Databases 33 Group data into tables, with columns (obviously) Identify a primary key for each table Might be more than one field.. Take out any repeating groups and put them on a separate table E.g. empID, name, project1, time1, project2, time2, project3,time3, etc Make sure every non-key column depends on the primary key. e..g on an Orders table, columns such as Order_date and Order_amount are valid. Storing client's details such as name, address and so on are not valid and should be on a separate table

S McKeeverAdvanced Databases 34 Remove repeating columns to a new table. Repeating columns are indicative of a missing relationship. e.g. on an Orders table it will not have item1, item2, and item3 columns for all items purchased. The items will be removed to a separate table linked to the orders table. Remove repetition within columns. e.g. a company may accept Visa, Mastercard and American Express for payment. Rather than repeat those strings in the order payment table, they can be places in a small lookup table and the order payment table can refer to their smaller primary key. i.e. orderID, date, payment type payment code, card description /2/10 v v Visa In practice, do the following checks as you design go, before “thinking” about normalisation (2)