0

I have to do uni project for database it is about medical center. Therefore, I made a conceptual and physical model, but now I have to model the database.

So i have relations patients, doctorID, general-practitioners, doctors-specialists, polyclinic and so on. The idea of my professor is that relation doctorID (that relation will only have doctorID atribute) give ID for both general-practitioners (ID,name,phone) and doctors-specialists (ID,name, speciality).

Now my problem is how to set the ID for general-practiotioners to be between 0 - 100 and for the doctors-specialist to be from 101 to 200. In addition, how to make that automated if someone starts writing new doctor-specialist that in my foreign/primary key attribute that he shows only from 101-200.

fab
  • 445
  • 4
  • 11
Mapet
  • 109
  • 1
  • 8
  • 1
    Have you tried something? – Melody Jan 05 '18 at 09:51
  • why do you want to differentiate with id? can't you use the doctor_type field? – Danyal Sandeelo Jan 05 '18 at 09:51
  • @Melody I am looking now solution on the internet. to try something.@Danyal Sandeelo well i was thinking about that field but to put it in the relation doctor specialist or in the doctorID relation? – Mapet Jan 05 '18 at 09:55
  • 1
    I would say that 'general practice' *is* a speciality – Strawberry Jan 05 '18 at 10:14
  • 4
    In general, if you find yourself worrying about the value of a primary key id, then you can be confident that there's something very wrong with your data model. – Strawberry Jan 05 '18 at 10:22
  • @Strawberry yes general practice is a speciality but i need to make difference in between gp doctors that we go every time we are ill and those doctors where we go after gp see some bigger problems with your body, like cancer, or i don't know pneumonia or kidney problem. – Mapet Jan 05 '18 at 10:37
  • [Don't use smart keys.](https://stackoverflow.com/a/34082143/3404097) Time to read an introduction to information modeling & relational database design. Also time to google the manuals re 'auto increment'. – philipxy Jan 05 '18 at 10:38
  • 1
    I cannot see why you would need to make this distinction. It sounds like a bad idea. – Strawberry Jan 05 '18 at 10:44

0 Answers0