a simple Q from a beginner
Posted in 2000
Topics: General Discussion
Dear All, If a doctor can prescribe several drugs for a patient. And a patient can take drugs from several doctors . How is the ER Diagram look like if every prescription of the same drug from the same doctor for the same patient are to be recorded, i.e. not only the latest prescription is recorded? thx a lot.
Hugo wrote: > > Dear All, > If a doctor can prescribe several drugs for a patient. And a > patient can take drugs from several doctors . How is the ER Diagram look > like if every prescription of the same drug from the same doctor for the > same patient are to be recorded, i.e. not only the latest prescription is > recorded? > > thx a lot. Well, it would look like a load of boxes with lines in between them. And some of the lines would have different little bits on the ends. No seriously, the professor must have already told you something about picking out entities. You have doctors, prescriptions, patients and perhaps drugs. So they go into the oblong boxes and then all you have to do is draw the lines between the boxes. Let's see, one doctor can write loads of prescriptions, so that's a one to many I think. A prescription can only be signed by one doc, so the two ends of the line have to look different to show this. The same goes for the patient - prescription relationship. Then when you come to design the table you know to put a doctor pointer on the prescription record so that loads of prescriptions can point to one doctor (giving you the history you need) instead of one doctor only being able to record one prescription (if you had a prescription pointer on the doctor record). Did I get it right? Good luck with the assignment. (Whatever happened to the old academic traditions like copying all your assignments out of Byte?). -- Andrew Pearson - Zutaten: Kartoffelflocken, Kartoffelgranulat, Kartoffelstärke, Pflanzenöl, modifizierte Stärke, Salz, Trockengemüse, Paniermehl, Hülsenfruchtemehl, Dextrose, Zucker, Monosodium Glutamat (E 621), Gewurz, Aromen. (Geschmack: käse mit speck).
Hugo wrote: > If a doctor can prescribe several drugs for a patient. And a > patient can take drugs from several doctors . How is the ER Diagram look > like if every prescription of the same drug from the same doctor for the > same patient are to be recorded, i.e. not only the latest prescription is > recorded? Boy, isn't homework fun? Well Hugo, it turns out that this is a trick question. If you get a copy of Zail Dioty's classic reference work, "E-ER and Relational Modeling for Complete Idiots" (St Fermin's Press, 1995), you'll find the following quote on pg 127-128: " Managing relationships between things in one set and things in another set can be awkward. A simplifying axiom to apply in such circumstances is to throw away problematic data. For example, in relationships between students and teachers, one student can have several teachers and teachers can have many students, often many times. The most effective way to cope with this is to ignore students completely. They rarely read the fucking text books assigned to them, anyway. " I sincerely hope this helps clarify your problem. KR Pb