I am currently studying Database Management and we were introduced to the idea of functional dependence:
Let A and B be attributes in a relation. B is considered functionally dependent on A if and only if for every A value you can determine a B value. i.e. A -> B
My question:
If this is the case, then given A, B, and C; if C can be evaluated arithmetically using A and B, can you consider C to be functionally dependent on A and B?
That is, (A/B) = C
<=> AB -> C
As an example:
Say I have a table containing online order information. It includes the attributes: PROD_PRICE
, QTY
, and TOTAL_PRICE
.
Seeing as the total price can be established by multiplying PROD_PRICE
by the QTY
is it accurate to say that PROD_PRICE
QTY
→ TOTAL_PRICE
?
Yes, by definition of functional dependency. In a functional dependency, in general, you have a set of attributes (the “determinant”) that determines another set (the “determinate”), that is each time in an instance of a relation we found the same value of the determinant the determinate must be equal, and this is true if the determinate is obtained as value of an expression over the determinate, like in your example.
Note that in general you do not know which is the function that produces the determinate from the determinant, simply you know that such a function exists. The functional dependency concept captures this fact, which is very important when representing data.
So, if for every row of a table we have
c=a/b
, thenab->c
, but for instance, whenPRODUCT_ID -> PRODUCT_NAME
holds, there is no mathematical function that can derive the latter from the former.