dimanche 1 mars 2015

Question about choosing primary key


My scenario is that I have a super type named PERSON and two sub types EMPLOYEE and CUSTOMER. I use the Primary key from PERSON, PersonID, in both EMPLOYEE and CUSTOMER as foreign keys. However, I don't use that as my primary key in EMPLOYEE and CUSTOMER but rather I make a new surrogate primary keys named EmployeeNum and CustomerNum in their respective tables. I was wondering does it break some sort of well formed/normalization rule if I do this? For example, in EMPLOYEE I think its clear that personID-->(employeeid, hiredate, hourlywage) and also employeeid-->(personid, hiredate, hourlywage), essentially both these keys can uniquely identify a unique row by themselves. Is that OK in practice? (also assume I don't want a composite primary key).





Aucun commentaire:

Enregistrer un commentaire