Why Functional Dependencies are important and why we use them in DB ?
If attribute b is functionally dependent on attribute a, this means that there is a function f such that f(a) = b. This means that whenever you have the value of a, the value of b follows from that.
An example would be passports: Your name is functionally dependent on your passport ID. This is because for every person, their passport ID is unique and therefore if you know the passport ID, you know that there is only one name associated with that id and therefore the name follows from the ID. On the other hand, the name is not functionally dependent on eye color because there are millions of people with the same eye color, so you cannot derive the name of a person from that person’s eye color.
Functional depencies are important in database design because they allow us to eliminate redundancies.
Using functional dependencies, you can apply Database normalization and thereby create a more efficient database.
Can you tell me how much important it is when it comes to practical implication, I have seen a lot of projects where developer avoid normalization to achieve a better database design
- A lot of developers don’t know or care about normalization, or about data modeling or database.
- For some jobs it’s really not important.
- Sometimes there’s a really good reason to de-normalize, for example to make a particular difficult workload perform well.
Normalization gives you a few key benefits:
- Minimizes the amount of redundant data.
- Maximizes the extent to which the database’s built in integrity mechanisms (foreign key constraints, uniqueness constraints) can be leveraged to ensure the integrity of the data.
- Reduces the number of columns per row increasing the efficiency of IO in some cases. Wide rows take longer to retrieve.
That said, there are plenty of valid reasons to denormalize:
- Performance, particularly for analytics, can be crippled by normalization. For analysis against relational databases, denormalized dimensional models are the standard approach.
- The benefit of enforcing data integrity inside of the database is starting to decline. As more and more development is focused on the object-oriented middle-tier that is often enforcing business rules, reliance on relational constraints in the database is less important.
- Normalization will complicate the queries required to retrieve relevant data.
Do check the source link of my answer, you will get a detailed answer: https://softwareengineering.stackexchange.com/questions/212822/why-many-designs-ignore-normalization-in-rdbms
The normalization process uses functional dependencies to seek out and eliminate redundancy in a database schema, thereby reducing the possibility of update anomalies.
The major use of functional dependency is in normalization.
A functional dependency is a constraint between two sets of attributes in arelation from a data base.In other words functional dependency is a constraint that describes the relationship between attributes in arelation.
Given a relation R,a set of attributes X in R is said to functionallydetermine another set of attributes Y,also in R,(written X->Y)if,and only if,each X value in R is associated with precisely one Y value in R ;R is then said to satisfy the functional dependency X->y.equivalently ,the projection "pie’X,Y R is a function,ie Y is a function of X .in simple words if value for X attributes are known,the the values for Y attributes corresponding to X can be determined by looking up in any tuple of R containing X.customarily X is called determinant set and Y is called the dependent set.a functional dependency FD:X->Y is called trivial if Y is a subset of X.
In other words ,a dependency FD: X->Ymenas that the values of Y are determined by the values of X.two tuples sharing the same values of Xwill necessarily have same values of Y.
The determination of functional dependebcies is an important part of designing databases in the relational model,and in database normalization and denormalization.The functional dependencies,along with the attribute domains,are selected so as to generate constraintsthat would exclude as much data inappropriate to the user domain for the system as possible and also the notion of logical implication for functional dependencies admits a sound and complete finite axiomatization,known as armstrongs axioms.