8

I am new to dbms. I saw a lecture video about functional dependencies. But I am confused a bit that whether functional dependency is a constraint put on whole database or on a particular schema?

9

A functional dependency is exactly what the term implies - the output of the function is always determined by the input. If for example we have a function f(), and provide variable x, and we always receive output y, then y is functionally dependent on x. You can think of this like a simple graphing function 2x + 1 = y Plugging some sample values into the function we get:

X    Y
------
1    3
2    5
3    7

and so on. Thus we know that for every value of x, there is value of y that will always be that value of y for that x.

Codd adapted this to data management with respect to determining if one data element's value always results in a known value of a second data element as if it were the input and output of a function. So for example, if we find that each employee of a small company is given an employee number, and we create a simple list of employee numbers and names, we find that the name is functionally dependent on that employee number. Every time we see the employee number 7 for example, we see the name "Jim Brown." This represents in the database the proposition that is true in the real world - namely that employee number 7 is the person named "Jim Brown" that we can point to and say "that's him."

Functional dependency can be implemented as a unique constraint because there is a one to one relationship between the input to the function and the expected output. In the algebra example, when we plug 2 into the equation 2x + 1 we will always get 5. Applying that example to data management in the example above, each time we have the employee number 7 we need to have one and only one name and other characteristics that goes with it. We can't have employee number 7 associated with "Jim Brown" and "Bob Jones" anymore than we could say that plugging 7 into 2x + 1 can yield 15 and 25. This application of simple math to data management is the fundamental underpinning that allows the DBMS to be told how to protect data integrity without having to understand the semantics of the data.

Functional dependencies are by definition implemented when a unique constraint is placed on each table identifying each set of data elements that have a one to one relationship with another set of data elements and whose values always vary with that first set. The notation is typically:

A,B ---> C

This means that the value of A and B determines the value of C. Perhaps A is employee number and B is Dependent Number, and C is the dependent's name. So in this sense they apply to each and every table in each and every schema in each and every database.

Some good references on relational theory are Fabian Pascal's Practical Database Foundation Series and Chris Date's book Relational Theory for Computer Professionals.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.