Search code examples
sqldatabasefunctional-dependenciestransitive-dependency

Is this a transitive dependency?


I have this simplified table:

enter image description here

The business states that anyone with a role_id of 3 needs to have a leader_id, while anyone with any other value for role_id should not have a leader_id (null).

By knowing the value of leader_id we now narrow down the possible values for role_id. Have I unwillingly created a transitive dependency between leader_id and role_id?


Solution

  • No it is not a transitive-dependency : the role alone doesn't provide you with enough information to find the leader; also, the leader alone doesn't provide enough information to find the role (for null values).

    A transitive-dependency means that you must be able to discover a value X from another value Y with a perfect score.

    For exemple, if you know the City, you obviously know the Country as well, you don't have to create two columns (city and country), you only need the city, and by using the transitive-dependency, you will get the country.