Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "RDA 1 - 1 Relational Data Analysis Stems from work of Ted Codd in early 1970s Led to relational database theory –Detailed mathematical theory Relational."— Presentation transcript:

1 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

2 RDA Relations (also known as Tables )

3 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

4 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

5 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

6 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

7 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

8 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

9 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

10 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 )

11 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

12 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.

13 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.

14 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

15 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

16 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.

17 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

18 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 *

19 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


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

Similar presentations


Ads by Google