I have been reading up on database design and I am having some difficulty constructing functional dependency diagrams from tables.
I have the following table. Each salesperson is identified by a salesperson’s number, and their sales activities are recorded for each month in the table.
I have made the following assumptions:
- Each Salesperson has a unique salesperson number
- Each Client has a unique client number
- Each product has a unique product number and description
- Each Customer has a unique sales persons that they deal with.
I have come up with the following functional dependencies diagram:
My questions are:
- First of all is this correct way of creating a fd diagram?
- Is this correct based upon the assumptions?
Functional dependencies aren't usually expressed in a diagram. Instead, they're usually expressed like this . . .
or like this.
If your diagram means that "Product number" -> "Quantity sold", then your diagram is wrong. Also, client number does not determine product number.
A functional dependency answers the question, "Given one value for A, can I determine one and only one value for B?", where A and B are sets of attributes. Let's look at a simple example.
Given one value for "Product number", can we determine one and only one value for "Product description"? Yes. Given the product number P1023-01, we can determine only one value for "Product description": "A4 Paper". Product number P1023-01 never matches up with any product name but "A4 Paper".
Given one value for "Product number", can we determine one and only one value for "Quantity sold"? No. Given the product number P1023-01, we can determine two different values for "Quantity sold": 6 and 10. The dependency "Product number" -> "Quantity sold" doesn't hold in this relation.