Understanding Functional Dependencies

I am currently studying functional dependencies and struggling to understand what is behind them.

Let's say I have a table:

Customer

|-----------|--------------|------------|------------------|------------------| |Cust-ID | Cust-FName |Cust-LName |Cust-Email |Cust-Pw | |-----------|--------------|------------|------------------|------------------| |1 |John |Smith | jsmith@email.com |srt6564sdgjhy55y | |2 |Adam |Borneo | adb@hotmail.com |45657ythjdfgqAfd | ------------------------------------------------------------------------------- 

There are two candidate keys: cust-ID and cust-Email (only one email address can belong to one client). Choosing cust-ID as PK will be the only functional dependency:

{Cust-ID} -> {Cust-FName, Cust-LName, Cust-Email, Cust-Pw} ?

Or, I would draw / imagine both candidate keys:

{Cust-ID} -> {Cust-FName, Cust-LName, Cust-Email, Cust-Pw}

{Cust-Email} -> {Cust-ID, Cust-FName, Cust-LName, Cust-Pw} ?

Instincts tell me that the first, but given that this is a completely new topic, I would appreciate any help!

+4
source share
2 answers

A set of functional dependency is always a superset of keys [of a candidate]. In other words, the key is a functional dependency with a list of attributes that spans the entire relationship. Thus, both of the candidate keys you specified are also functional dependencies.

+1
source

Both

 {Cust-ID} -> {Cust-FName, Cust-LName, Cust-Email, Cust-Pw} 

{Cust-Email} -> {Cust-ID, Cust-FName, Cust-LName, Cust-Pw}

- these are functional dependencies in your case.

A functional dependency is such a situation: whenever you have two rows that have the same value for the column on the left side of the arrow, the column values ​​on the right side of the arrow should be the same. If you have two rows with the same Cust-ID, then the columns for the name, email and password should be the same. If you have two rows with the same Cust-Email, then (in your example) the columns of the name, email address and password should be the same.

If your table is not in the third normal form, then it is possible that you have a functional dependency with the corresponding key subset on the left side. In fact, you define a candidate key and normal forms (2NF, 3NF, BCNF) in terms of functional dependencies.

You can learn more about functional dependencies in our company blog . This is the first part in a series of data normalization messages.

0
source

All Articles