Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Copyright © 2004 M. E. Kabay. All rights reserved. Database Design (2) IS 240 – Database Management Lecture #11 – 2004-03-18 Prof. M. E. Kabay, PhD,

Similar presentations


Presentation on theme: "1 Copyright © 2004 M. E. Kabay. All rights reserved. Database Design (2) IS 240 – Database Management Lecture #11 – 2004-03-18 Prof. M. E. Kabay, PhD,"— Presentation transcript:

1 1 Copyright © 2004 M. E. Kabay. All rights reserved. Database Design (2) IS 240 – Database Management Lecture #11 – Prof. M. E. Kabay, PhD, CISSP Norwich University

2 2 Copyright © 2004 M. E. Kabay. All rights reserved. Topics Recursive Relationships Ternary Relationships Homework

3 3 Copyright © 2004 M. E. Kabay. All rights reserved. Recursive Relationships (1) Suppose a plant can originate from a single cutting or can produce a single cutting. Diagram this entity here using the E-R notation:

4 4 Copyright © 2004 M. E. Kabay. All rights reserved. Recursive Relationships (1*) Suppose a plant can originate from a single cutting or can produce a single cutting. Diagram this entity here using the E-R notation: 1:1 Cutting Plant

5 5 Copyright © 2004 M. E. Kabay. All rights reserved. Recursive Relationships (2) What if a plant can produce several cuttings? Change the diagram to suit this constraint

6 6 Copyright © 2004 M. E. Kabay. All rights reserved. Recursive Relationships (2*) What if a plant can produce several cuttings? Change the diagram to suit this constraint 1:N Cutting Plant

7 7 Copyright © 2004 M. E. Kabay. All rights reserved. Recursive Relationships (3) Suppose several plants can have cuttings combined into grafts to produce several other plants. Draw an E-R diagram to represent this situation

8 8 Copyright © 2004 M. E. Kabay. All rights reserved. Recursive Relationships (3*) Suppose several plants can have cuttings combined into grafts to produce several other plants. Draw an E-R diagram to represent this situation M:N Cutting Plant

9 9 Copyright © 2004 M. E. Kabay. All rights reserved. Recursive Relationships (4) Now show relations that will model the ER diagrams you developed for the previous slides starting with: 1:1 recursion – 1 plant, 1 cutting

10 10 Copyright © 2004 M. E. Kabay. All rights reserved. Recursive Relationships (4*) Now show relations that will model the ER diagrams you developed for the previous slides starting with: 1:1 recursion – 1 plant, 1 cutting Plant #1Plant #11 Plant #2Plant #21 Plant #11Plant #111 Source_plant Cutting_plant

11 11 Copyright © 2004 M. E. Kabay. All rights reserved. Recursive Relationships (5) Show the relations to model a 1:N recursion – 1 plant, many cuttings

12 12 Copyright © 2004 M. E. Kabay. All rights reserved. Recursive Relationships (5*) Show the relations to model a 1:N recursion – 1 plant, many cuttings Source_plant Cutting_plant Plant #1Plant #11 Plant #1Plant #12 Plant #2Plant #21 Plant #3Plant #31 Plant #3Plant #32 Plant #31Plant #311

13 13 Copyright © 2004 M. E. Kabay. All rights reserved. Recursive Relationships (6) Show the relations to model an M:N recursion – many plants can combine to produce many grafts

14 14 Copyright © 2004 M. E. Kabay. All rights reserved. Recursive Relationships (6*) Show the relations to model an M:N recursion – many plants can combine to produce many grafts Plant 1… Plant 2… Plant 3… Plant_ID Other_info Plant_A Plant_B Date_etc Plant 1Plant 2… Plant 1Plant 3… Plant 1Plant 4… Plant 2Plant 4…

15 15 Copyright © 2004 M. E. Kabay. All rights reserved. Ternary Relationships (1) Think about the doctor(s) who prescribe(s) something, the prescription(s), and the patient(s) who receive(s) the prescription(s) Use E-R diagrams to describe this situation:

16 16 Copyright © 2004 M. E. Kabay. All rights reserved. Ternary Relationships (1*) Think about the doctor(s) who prescribe(s) something, the prescription(s), and the patient(s) who receive(s) the prescription(s) Use E-R diagrams to describe this situation: M:N

17 17 Copyright © 2004 M. E. Kabay. All rights reserved. Ternary Relationships (2) Develop relations to model the entity relationships described on the previous slide:

18 18 Copyright © 2004 M. E. Kabay. All rights reserved. Ternary Relationships (2*) Develop relations to model the entity relationships described on the previous slide: Doctor 1Info… Doctor 2Info… Doctor 3Info… Patient 1Info… Patient 2Info… Patient 3Info… Doc1Pat1DateDrug Doc1Pat2DateDrug Doc1Pat3DateDrug Doc2Pat1DateDrug Doc3Pat2DateDrug Doc4Pat3DateDrug Doc4Pat3DateDrug Doc5Pat3DateDrug …

19 19 Copyright © 2004 M. E. Kabay. All rights reserved. Ternary Relationships (3) For the doctor / patient / prescription relations, How would you model the prescription- doctor-patient relationship if you added the constraint that some drugs must never be prescribed at the same time? Show the relations on the next page

20 20 Copyright © 2004 M. E. Kabay. All rights reserved. Ternary Relationships (4) Draw the relations showing constrained combinations of drugs Drug 1Info… Drug 2Info… Drug 3Info… Drug 1Drug 4 Drug 1Drug 6 Drug 2Drug 6 Drug 4Drug 1 Drug 6Drug 1 Drug 6Drug 2 First Second DRUG TABLE FORBIDDEN COMBINATIONS Are the duplications a problem?

21 21 Copyright © 2004 M. E. Kabay. All rights reserved. Ternary Relationships (4*) Draw the relations showing constrained combinations of drugs

22 22 Copyright © 2004 M. E. Kabay. All rights reserved. Homework For Tuesday 23 Mar 2004 Review Chapter Six material pp in detail Finish reading/reciting the rest of Chapter Six to complete your preparation for our next course meeting For Thursday 25 Mar 2004 Complete Group I questions for 20 points Hand them in at the Business Division office by noon There will be no class that day – come to the E-ProtectIT Conference in Milano if you can. See for detailshttp://www.e-protectit.org

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


Download ppt "1 Copyright © 2004 M. E. Kabay. All rights reserved. Database Design (2) IS 240 – Database Management Lecture #11 – 2004-03-18 Prof. M. E. Kabay, PhD,"

Similar presentations


Ads by Google