What is a data dependency ?
Data dependency is a constraint/condition imposed on the contents of a database and always valid in every permanent state of a database.
Data dependency is a reflection of the real world constraint in the contents of a database. For example, in the reality it is always true that age of a person is a positive number. It is impossible to have a negative age, well, maybe it is because we cannot travel back in time. A reflection of such real world constraint on the contents of a database is a condition enforced on the contents of a column "age" in a relational table and says that "age" > 0.
What is a functional dependency ?
A functional dependency is a special kind of data dependency saying that each value in a column or a tuple of values in the columns can be associated with only one value in another column or a tuple of values in another columns.
A functional dependency is called "functional" because it is a function that maps the values in a column or a tuple of values in the columns into one value in another column or a tuple of values in another columns.
Consider Let be a relational schema (a header of relational table) R that consists of n columns (attributes) ( A1, ..., An). Assume that X, Y are the nonempty subsets of as schema R, for example X = {A1,A3} and Y = {A5}
We say that a functional dependency X → Y (X functionally determines Y) is valid in a relational schema R if for any contents of a relational table R, it is not possible that R has two rows that agree in the components for all attributes in a set X yet disagree on one or more component for the attributes in a set Y. For example if {A1,A3} → {A5} then it means that every pair of values of attributes A1, A3 is associated in. any state of a relational table R, with only one values of an attribute A5.
For example, if a warehouse is located at one address then warehouse → address (warehouse functionally determines address) and it means that every value in a column warehouse is associated with only one value in a column address.
For example, if at each address there is only one warehouse then address → warehouse (address functionally determines warehouse) and it means that every value in a column address is associated with only one value in a column warehouse.
For example, if at each warehouse the parts of the same sort have only one total quantity then warehouse,part → quantity ( a pair of attributes warehouse, part functionally determine an attribute quantity)and it means that every pair of values in the columns warehouse and part is associated with only one value in a column quantity.
For example, if a car has one owner then registration → driving license (a registration number functionally determines driving license of its owner) and it means that each value in a column registration is associated with one value in a column driving license.
For example, if a students has one first name and one last name and one date of birth then student-number → first-name, last-name-date-of-birth (a student number functionally determines first name, last name and date of birth) and it means that each value in a column student number is associated with one value in a column first name, one value in a column last name and one value in a column date of birth).