RDA 1 - 1 Relational Data Analysis Stems from work of Ted Codd in early 1970s Led to relational database theory –Detailed mathematical theory Relational.

Slides:



Advertisements
Similar presentations
Database Fundamentals
Advertisements

The Relational Model and Normalization (3) IS 240 – Database Management Lecture # Prof. M. E. Kabay, PhD, CISSP Norwich University
The Relational Model and Normalization (1)
Copyright: ©2005 by Elsevier Inc. All rights reserved. 1 Author: Graeme C. Simsion and Graham C. Witt Chapter 3 The Entity-Relationship Approach.
Author: Graeme C. Simsion and Graham C. Witt Chapter 4 Subtypes & Supertypes.
Database Design: Normalization J.G. Zheng June 29 th 2005 DB Chapter 4.
Relational Database and Data Modeling
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
0 - 0.
SUBTRACTING INTEGERS 1. CHANGE THE SUBTRACTION SIGN TO ADDITION
MULT. INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
Addition Facts
Fourth normal form: 4NF 1. 2 Normal forms desirable forms for relations in DB design eliminate redundancies avoid update anomalies enforce integrity constraints.
Relational data objects 1 Lecture 6. Relational data objects 2 Answer to last lectures activity.
Introduction to SQL 1 Lecture 5. Introduction to SQL 2 Note in different implementations the syntax might slightly differ different features might be.
Dependency preservation, 3NF revisited and BCNF
1 Term 2, 2004, Lecture 2, Normalisation - IntroductionMarian Ursu, Department of Computing, Goldsmiths College Normalisation Introduction.
Normalisation.
UFCE8V-20-3 Information Systems Development 3 (SHAPE HK)
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
ADTs unsorted List and Sorted List
Chapter 5 Normalization of Database Tables
Database Design Process
ITS232 Introduction To Database Management Systems
First Normal Form Second Normal Form Third Normal Form
Functional Dependencies and Normalization for Relational Databases
Addition 1’s to 20.
25 seconds left…...
Week 1.
Chapter 15 A Table with a View: Database Queries.
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.
Normalisation Ensuring data integrity in database design 1.
Monash University Week 7 Data Modelling Relational Database Theory IMS1907 Database Systems.
1 An Introduction to Databases Dr Stephen Swift The Intelligent Data Analysis Group Brunel University.
Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
Relational Data Analysis Learning outcomes  understand the process of normalisation;  perform Relational Data Analysis;  recognise the importance of.
SLIDE 1IS 257 – Fall 2004 Database Design: Normalization and The Relational Model University of California, Berkeley School of Information.
Chapter 5 Normalization Transparencies © Pearson Education Limited 1995, 2005.
Relational Data Analysis II. Plan Introduction Structured Methods –Data Flow Modelling –Data Modelling –Relational Data Analysis Feasibility Maintenance.
Project and Data Management Software
Database – Part 2a Dr. V.T. Raja Oregon State University.
Introduction to Schema Refinement. Different problems may arise when converting a relation into standard form They are Data redundancy Update Anomalies.
Chapter 5 Normalization of Database Tables
Normalization. Introduction Badly structured tables, that contains redundant data, may suffer from Update anomalies : Insertions Deletions Modification.
Week 6 Lecture Normalization
Lecture 12 Inst: Haya Sammaneh
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)
Avoiding Database Anomalies
Normalization. 2 Objectives u Purpose of normalization. u Problems associated with redundant data. u Identification of various types of update anomalies.
NormalizationNormalization Chapter 4. Purpose of Normalization Normalization  A technique for producing a set of relations with desirable properties,
RDBMS Concepts/ Session 3 / 1 of 22 Objectives  In this lesson, you will learn to:  Describe data redundancy  Describe the first, second, and third.
Normalization. Learners Support Publications 2 Objectives u The purpose of normalization. u The problems associated with redundant data.
Normalization Transparencies
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.
Copyright: ©2005 by Elsevier Inc. All rights reserved. 1 Chapter - 2 Basics of Sound Structure Author: Graeme C. Simsion and Graham C. Witt.
Normalization Well structured relations and anomalies Normalization First normal form (1NF) Functional dependence Partial functional dependency Second.
Lecture 5 Normalization. Objectives The purpose of normalization. How normalization can be used when designing a relational database. The potential problems.
Chapter 10 Normalization Pearson Education © 2009.
In this session, you will learn to: Describe data redundancy Describe the first, second, and third normal forms Describe the Boyce-Codd Normal Form Appreciate.
Programming Logic and Design Fourth Edition, Comprehensive Chapter 16 Using Relational Databases.
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.
Logical Database Design and Relational Data Model Muhammad Nasir
SLIDE 1IS 257 – Fall 2006 Normalization Normalization theory is based on the observation that relations with certain properties are more effective.
Normalisation FORM RULES 1NF 2NF 3NF. What is normalisation of data? The process of Normalisation organises your database to: Reduce or minimise redundant.
1 CS490 Database Management Systems. 2 CS490 Database Normalization.
Normalization Karolina muszyńska
Presentation transcript:

RDA Relational Data Analysis Stems from work of Ted Codd in early 1970s Led to relational database theory –Detailed mathematical theory Relational data analysis for database design –Bottom-up technique based on analysing the inter-relationships between attributes Logical Data Structuring Relational Data Analysis Enhanced Logical Data Model

RDA Relations (also known as Tables )

RDA Properties of Relations Rows –show occurrences of Patient –each row must be uniquely identifiable –order of rows must NOT be significant Columns –column name = attribute type –each value = attribute occurrence –order of columns must not be significant –only one value should be associated with each column/row intersection in the table Domain –pool of possible values from which the actual values appearing in the columns of the table are drawn e.g. domain of Patient Numbers includes all of the possible Patient Numbers, not just the ones currently in hospital. –important for comparing values from different tables

RDA Normalised Relations Objective The organisation of a system's attributes into a set of well normalised relations. Well normalised relations avoid: –unnecessary duplication of data i.e. no redundant data –problems with modifying, inserting and deleting data N.B. sometimes referred to as the update anomalies

RDA Stages of Normalisation Normalised takes place in stages Each stage is known as a normal form Each stage is a development from the previous stage Un-Normalised Form First Normal Form Second Normal Form Third Normal Form

RDA Sample Source of Data DRUG CARD Patient No.SurnameForename Ward No.Ward Name Drugs Prescribed DateDrug CodeDrug NameDosage Length of Treatment 923MoneybagsMaurice 10Barnard 20/5/88 CO2355PCortisone 2 pills 3 x day after meals 14 days 20/5/88MO3416TMorphine Injection every 4 hours 5 25/5/88 MO3416TMorphineInjection every 8 hours 3 26/5/88PE8694NPenicillin1 pill 3 x day7 for additional drugs continue on another card DRUG CARD Patient No.SurnameForename Ward No.Ward Name Drugs Prescribed DateDrug CodeDrug NameDosage Length of Treatment 109FootIvor 11Fleming 15/5/88 AS473A 2 pills 3 x day after meals 7 days 20/5/88VA231MValium2 per day5 for additional drugs continue on another card Aspirin

RDA Steps in Normalisation - 1 Un-normalised Form Represent the data in un-normalised form and pick a key. Column headings (attribute names) should be meaningful Choice of key attribute/attributes –must be unique for the particular data source –may require two or more attributes e.g. Invoice No. and Supplier, because different suppliers may send invoices having the same number –use smallest combination of attributes possible –avoid textual keys wherever possible

RDA Data Re-organised from Drug Cards Patient Number is chosen as primary key and underlined Prescn Date Drug CodeDrug NameDosage Length Trtmnt 20/5/88 CO2355PCortisone 2 pills 3 x day after meals 14 20/5/88MO3416TMorphine Injection every 4 hours 5 25/5/88 MO3416TMorphineInjection every 8 hours 3 26/5/88PE8694NPenicillin1 pill 3 x day7 15/5/88 AS473A 2 pills 3 x day after meals 7 20/5/88Valium2 per day5 AspirinFleming Barnard10 11 Maurice Ivor Moneybags Foot Pat No. Surname Fore -name Wd No. Ward Name VA231M

RDA Steps in Normalisation - 2 First Normal Form Remove any repeating groups of ATTRIBUTES to separate relations Pick keys for any relations identified Drug Code Drug NameDosage Length Trtmnt 20/5/88 CO2355PCortisone 2 pills 3 x day after meals 14 20/5/88MO3416TMorphineInjection every 4 hours 5 25/5/88MO3416TMorphineInjection every 8 hours 3 26/5/88PE8694NPenicillin1 pill 3 x day7 15/5/88 AS473A 2 pills 3 x day after meals 7 20/5/88Valium2 per day5 Aspirin Pat No Prescn Date VA231M

RDA Repeating Groups Any attribute or group of attributes that may occur with multiple values for a single value of the primary key attribute. Several values of Drug Code, Drug Name, Prescription Date, Dosage and Treatment Length for one value of Patient Number –Remove to new relation Key of new relation will be a compound key involving several attributes: –key identified in Step 1 (Patient No.) –further items required to make each row in the new relation unique (Drug Code and Prescription Date )

RDA Non-repeating Attributes Attributes that do not repeat remain as a relation Fleming Barnard10 11 Maurice Ivor Moneybags Foot Pat No. Surname Fore -name Wd No. Ward Name

RDA Functional Dependency For any two attributes A and B, A is dependent on B if and only if –for a given value of B there is precisely one associated value of A at any one time. e.g. Patient Surname is totally dependent on Patient Number because each patient is given a unique Patient Number Another way of describing this is to say that: –Attribute B determines attribute A i.e. Patient Number determines Patient Surname NB The opposite is not true: For a given value of Patient Surname, say Moneybags, there may be several Patient Numbers, as there may be several patients called Moneybags in the hospital together. Dependency can also occur with groups of attributes.

RDA Steps in Normalisation - 3 Second Normal Form Remove ATTRIBUTES that only depend upon part of the key to separate relations Only applies to compound key relations NB. Others are already in Second Normal Form Thus –Patient Number, Prescription Date, and Drug Code in combination determine attributes Dosage and Treatment Length However –Drug Name is only dependent on part of the key (Drug Code) and can be removed from the relation –Drug Code and Drug Name form a new relation with Drug Code as the key.

RDA Development to Second Normal Form Drug CodeDrug NameDosage Length Trtmnt 20/5/88 CO2355PCortisone 2 pills 3 x day after meals 14 20/5/88MO3416TMorphineInjection every 4 hours 5 25/5/88MO3416TInjection every 8 hours 3 26/5/88PE8694N Penicillin 1 pill 3 x day7 15/5/88 AS473A 2 pills 3 x day after meals 7 20/5/88 Valium 2 per day5 Aspirin Pat No Drug Code CO2355P MO3416T PE8694N AS473A Prescn Date VA231M

RDA Steps in Normalisation - 4 Third Normal Form Remove any ATTRIBUTES not directly and fully dependent on the key to separate relations. Create a separate relation for attributes which can be uniquely determined by any other attribute in the relation The key attribute in the separate relation must uniquely determine the remaining attributes in a one-to-one relationship Fleming Barnard10 11 Maurice Ivor Moneybags Foot Pat No. Surname ForenameWard No. Ward Name

RDA Example in Third Normal Form Fleming Barnard10 11 Maurice Ivor Moneybags Foot Pat No. Surname Fore -name Wd No. Ward Name Wd No. Patient No. does not uniquely determine Ward No. or Ward Name, because the patient might be in different wards at different times. Ward No uniquely determines Ward Name, and these attributes can therefore be removed to a separate relation. Ward No becomes a foreign key in the Patient relation.

RDA Full Set of Well Normalised Relations Drug Name Cortisone Morphine Penicillin Valium Aspirin Drug Code CO2355P MO3416T PE8694N AS473A VA231M Drug Code Dosage Lgth Treat 20/5/88 CO2355P 2 pills 3 x day after meals 14 20/5/88MO3416TInjection every 4 hours 5 25/5/88MO3416TInjection every 8 hours 3 26/5/88PE8694N1 pill 3 x day 7 15/5/88 AS473A 2 pills 3 x day after meals 7 20/5/882 per day 5 Pat No VA231M Presc Date Maurice Ivor Moneybags Foot Pat No Surname Forename Wd No. Fleming Barnard10 11 Wd No. Ward Name

RDA SSADM Notation SYSTEM:DATE / /AUTHOR Source ID No.:Name of Source: UNF1NF2NF3NF Hospital Drug Card Patient Number Patient Surname Patient Forename Ward Number Ward Name Prescription Date Drug Code Drug Name Dosage Length of Treatment Patient Number Patient Surname Patient Forename Ward Number Ward Name Patient Number Prescription Date Drug Code Drug Name Dosage Length of Treatment Patient Number Patient Surname Patient Forename Ward Number Ward Name Patient Number Prescription Date Drug Code Dosage Length of Treatment Drug Name Drug Code Patient Number Prescription Date Drug Code Dosage Length of Treatment Drug Name Drug Code Patient Surname Patient Forename Ward Number Patient Number Ward Name Ward Number *

RDA Relations as a Logical Data Structure Drug Code Dosage Trt Lgth 20/5/88 CO2355P 2 pills 3 x day after meals 14 20/5/88MO3416T Injection every 4 hours 5 25/5/88MO3416T Injection every 8 hours 3 26/5/88PE8694N1 pill 3 x day 7 15/5/88 AS473A 2 pills 3 x day after meals 7 20/5/882 per day 5 Pat No VA231M Prescr Date Maurice Ivor Moneybags Foot Pat No Surname Forename Wd No Patient Fleming Barnard Wd No Ward Name Ward Prescription Drug Name Cortisone Morphine Penicillin Valium Aspirin Drug Code CO2355P MO3416T PE8694N AS473A VA231M Drug