b mapping the ternary relationship patient treatment

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: entity with unary relationship (b) EMPLOYEE relation with recursive foreign key 31 Mapping a unary M:N relationship (a) Bill-of-materials relationships (M:N) (b) ITEM and COMPONENT relations 32 Mapping Ternary Relationships One relation for each entity and one for the associative entity Associative entity has foreign keys to each entity in the relationship 33 Mapping a ternary relationship a) PATIENT TREATMENT Ternary relationship with associative entity 34 Mapping a ternary relationship (cont.) b) Mapping the ternary relationship PATIENT TREATMENT Remember that the primary key MUST be unique This is why treatment date and time are included in the composite primary key But this makes a very cumbersome key… It would be better to create a surrogate key like Treatment# 35 Mapping Supertype/Subtype Relationships One relation for supertype and for each subtype Supertype attributes (including identifier and subtype discriminator) go into supertype relation Subtype attributes go into each subtype; primary key of supertype relation also becomes primary key of subtype relation 1:1 relationship established between supertype and each subtype, with supertype as primary table 36 Supertype/subtype relationships 37 Mapping Supertype/subtype relationships to relations These are implemented as one-to-one relationships 38 Data Normalization Primarily a tool to validate and improve a logical design so that it satisfies certain constraints that avoid unnecessary duplication of data The process of decomposing relations with anomalies to produce smaller, well­structured relations 39 Well­Structured Relations A relation that contains minimal data redundancy and allows users to insert, delete, and update rows without causing data inconsistencies Goal is to avoid anomalies Insertion Anomaly–adding new rows forces user to create duplicate data Deletion Anomaly–deleting rows may cause a loss of data that would be needed for other future rows Modification Anomaly–changing data in a row forces changes to other rows because of duplication Ge...
View Full Document

This note was uploaded on 07/23/2012 for the course COMP 1730 taught by Professor Tony during the Spring '06 term at British Columbia Institute of Technology.

Ask a homework question - tutors are online