I am a bit stuck designing part of a database.
I have a table called Staff
. It has different attributes:
StaffID
First Name
Last Name
Job Title
Department Number
Telephone Number
StaffID
is the primary key in this table.
My issue however, is that it is possible to find any information based on the telephone number (i.e. each staff member has a different, unique telephone number).
For example, this means that the First Name
or Job Title
can be found when we have the Phone Number
. However, Phone Number
is not a primary key, StaffID
is.
I am not sure whether this is a transitive dependency and should fixed through 3NF by splitting up the table and having the Staff table
without the Phone Number
and another table with just StaffID
and Telephone Number
.
Transitive dependency occurs only if you have indirect relationship between more than 2 attributes that are not part of they key.
In your example, as you explained, the StaffID
is part of your dependency, which is fine because it's the primary key.
Also you can look at this question that shows what is wrong with a transitive dependency. It could help put things into perspective.
In your table, if you delete staff member, you delete all the information (rightly so because you don't need it). If you leave phone number in a different table and, for instance, delete entry only in Staff
, you're left with a wild phone number. But if your Staff
table allowed multiple entries for the same person (but different departments) then the situation would be different.
Other sites that helped me in the past:
https://www.thoughtco.com/transitive-dependency-1019760 https://beginnersbook.com/2015/04/transitive-dependency-in-dbms/
Funnily they always follow the book example : )