sunnyman wrote:
Thanks for reply,
First I suggest you rearrange the forums by topics, because I think many questions are repeated, for example, separate topic for inheritance, win forms binding, asp binding and so on to save you a lot of repeated questions.
That has been brought up before, but it's often not clear which topic to pick for a given question if it touches multiple topics. So it will then lead to crossposts, wrong forum posts...
We now have almost 10,000 threads on this forum and over 40,000 messages. The only way people will find threads which relate to their problem is via the search. It's not doable to rely on 'look in that forum and you'll find threads you need' anymore, the # of threads and posts is too big.
You are right of course, but in hospital software a Doctor/Nurse Entities is a must
Doctor entity have for example Medical_Specialization_ID which is a (Not Null –FK) with Medical_Specialization Table so it makes sense to give a doctor a separate entity.
True, though semantically, Doctor and Nurse can't be in the same inheritance chain, other than that they're siblings and inheriting from the same parent.
I mean, nurses won't become doctors, and doctors often refuse to act like nurses
.
The only problem comes from HR – Employee point of view, some doctors are employees and takes salary, some are not and just use hospital to make their private operations,
But both types of doctors are FK in the Operation Table (SurgeonDoctorID) so again it makes sense to seperate a Doctor Entity
Agreed.
Now, what is the good design for HR-Employee table?
EMP (empID, code, name, jobID) where jobID is discriminator
But what about all other properties of doctor entity that have real relation with other many tables
Or
Person (PersonID, code, Name)
Person->Doctor (1-1 and use llblgen inheritance PerEntity)
Person->Nurse (1-1 and use llblgen inheritance PerEntity)
EMP (personID, Salary) no inheritance because it will not work with llblgen, just unique PersonID
Or both designs are wrong
Well, doctor has a relation others don't have. So I wouldn't opt for a hierarchy of type TargetPerEntityHierarchy. You could of course use that type, but it's harder to build FK integrity checks into the db for these. (you've to fall back on check constraints).
I'd go for person -> doctor and person-> nurse, IF you need to share a lot of attributes between nurse and doctor and for example also relations, then the same supertype for both would be useful (so you can re-use the table).