Presentation is loading. Please wait.

Presentation is loading. Please wait.

Database Design (1) IS 240 – Database Management Lecture #10 – 2004-03-16 Prof. M. E. Kabay, PhD, CISSP Norwich University

Similar presentations


Presentation on theme: "Database Design (1) IS 240 – Database Management Lecture #10 – 2004-03-16 Prof. M. E. Kabay, PhD, CISSP Norwich University"— Presentation transcript:

1 Database Design (1) IS 240 – Database Management Lecture #10 – Prof. M. E. Kabay, PhD, CISSP Norwich University

2 2 Copyright © 2004 M. E. Kabay. All rights reserved. Topics Goals Applying Normalization Representing Weak Entities 1:1 Relationships 1:N Relationships M:N Relationships Homework

3 3 Copyright © 2004 M. E. Kabay. All rights reserved. Goals Learn how to think about structuring information for implementation in any DBMS In other words: Learn to move from business rules to entities and relationships to database structures Material is completely independent of specific DBMS you plan to use

4 4 Copyright © 2004 M. E. Kabay. All rights reserved. Applying Normalization Dont worry about normalization when you are listing the attributes of an entity Describe the relation and list any business rules that you know E.g., PATIENT entity might be perceived by users as containing PatientID Patient-specific information Location info Doctor_ID for treating physician Doctor-related info

5 5 Copyright © 2004 M. E. Kabay. All rights reserved. Normalization (contd) However, we can instantly tell that this entity does not yet represent a normalized relation because There are two themes involved: _____ and _____ There is a relationship between _____ and _____ There may be more than one ______ for each ____ and more than one _____ for each _____

6 6 Copyright © 2004 M. E. Kabay. All rights reserved. Normalization (contd) A simple, intuitively satisfying set of relations would define the following entities: Patient Doctor Patient-Doctor relationship What would the three relations look like? [Class responds quickly and enthusiastically to opportunity to demonstrate savvy]

7 7 Copyright © 2004 M. E. Kabay. All rights reserved. Representing Weak Entities Suppose a PRESCRIPTION cannot exist without a PATIENT and a DOCTOR Prescription is thus a weak entity because it depends on the existence of at least one parent How would you structure these three relations? [Class erupts into vociferous exclamations of details]

8 8 Copyright © 2004 M. E. Kabay. All rights reserved. 1:1 Relationships One patient is assigned to no more than one bed at a time One assigned bed may have no more than one patient assigned at a time A patient may be in the system without a bed assigned (why?) A bed may be in the system without having a patient assigned (why?) Show how to represent this relationship With a diagram With relations

9 9 Copyright © 2004 M. E. Kabay. All rights reserved. 1:1 Relationships (contd) What if there is a 1:1 relationship that requires exactly one disposal lock box (with a unique serial number) to be assigned to exactly one patient? Draw this relationship with a diagram Should this be one, two or three relations? Why?

10 10 Copyright © 2004 M. E. Kabay. All rights reserved. 1:N Relationships Suppose 1 patient may have multiple saline bags over time, each with a unique identifier and certain attributes (e.g., concentration) No saline bag may be shared among patients Represent this relationship using a diagram Explain how to structure relations to represent this information

11 11 Copyright © 2004 M. E. Kabay. All rights reserved. Weak Entities in 1:N Relationships Imagine that the previous example adds another rule: no saline bag can be entered into the system unless it is being used by a patient How would you change the design in the previous slide? What is special about the key you have to use to represent weak entities?

12 12 Copyright © 2004 M. E. Kabay. All rights reserved. M:N Relationships Suppose a patient can have several doctors at once And a doctor can have several patients at once You would like to be able to know Which patients a doctor is taking care of Which doctors are responsible for a specific patient How would you draw these relationships? How would you design the data structures?

13 13 Copyright © 2004 M. E. Kabay. All rights reserved. Homework For Thursday 18 Mar 2004, Apply the complete SQ3R to Chapter 6 of Kroenke, pp in preparation for the homework exercises Apply the SQ phases of SQ3R to the rest of Chapter 6 in preparation for the next class For Tuesday 23 Mar 2004, for 14 points, complete Group 1 questions 6.1 to 6.14

14 14 Copyright © 2004 M. E. Kabay. All rights reserved. DISCUSSION


Download ppt "Database Design (1) IS 240 – Database Management Lecture #10 – 2004-03-16 Prof. M. E. Kabay, PhD, CISSP Norwich University"

Similar presentations


Ads by Google