The procedure to reach [math]F_{min}[/math] should indeed proceed by eliminating single redundant FDs and after that look for the next one to eliminate. So do not eliminate at each step all FDs that at that point are redundant, as you seem to suggest. Eliminating them one by one makes the algorithm non-deterministic, and that is how it should be, because in some cases there is not a unique [math]F_{min}[/math].
Where do I start?
I’m a huge financial nerd, and have spent an embarrassing amount of time talking to people about their money habits.
Here are the biggest mistakes people are making and how to fix them:
Not having a separate high interest savings account
Having a separate account allows you to see the results of all your hard work and keep your money separate so you're less tempted to spend it.
Plus with rates above 5.00%, the interest you can earn compared to most banks really adds up.
Here is a list of the top savings accounts available today. Deposit $5 before moving on because this is one of th
Where do I start?
I’m a huge financial nerd, and have spent an embarrassing amount of time talking to people about their money habits.
Here are the biggest mistakes people are making and how to fix them:
Not having a separate high interest savings account
Having a separate account allows you to see the results of all your hard work and keep your money separate so you're less tempted to spend it.
Plus with rates above 5.00%, the interest you can earn compared to most banks really adds up.
Here is a list of the top savings accounts available today. Deposit $5 before moving on because this is one of the biggest mistakes and easiest ones to fix.
Overpaying on car insurance
You’ve heard it a million times before, but the average American family still overspends by $417/year on car insurance.
If you’ve been with the same insurer for years, chances are you are one of them.
Pull up Coverage.com, a free site that will compare prices for you, answer the questions on the page, and it will show you how much you could be saving.
That’s it. You’ll likely be saving a bunch of money. Here’s a link to give it a try.
Consistently being in debt
If you’ve got $10K+ in debt (credit cards…medical bills…anything really) you could use a debt relief program and potentially reduce by over 20%.
Here’s how to see if you qualify:
Head over to this Debt Relief comparison website here, then simply answer the questions to see if you qualify.
It’s as simple as that. You’ll likely end up paying less than you owed before and you could be debt free in as little as 2 years.
Missing out on free money to invest
It’s no secret that millionaires love investing, but for the rest of us, it can seem out of reach.
Times have changed. There are a number of investing platforms that will give you a bonus to open an account and get started. All you have to do is open the account and invest at least $25, and you could get up to $1000 in bonus.
Pretty sweet deal right? Here is a link to some of the best options.
Having bad credit
A low credit score can come back to bite you in so many ways in the future.
From that next rental application to getting approved for any type of loan or credit card, if you have a bad history with credit, the good news is you can fix it.
Head over to BankRate.com and answer a few questions to see if you qualify. It only takes a few minutes and could save you from a major upset down the line.
How to get started
Hope this helps! Here are the links to get started:
Have a separate savings account
Stop overpaying for car insurance
Finally get out of debt
Start investing with a free bonus
Fix your credit
Driver: What the hell? We seem to be crashing!
Passenger: I removed the front left wheel
Driver: You what?!
Passenger: I removed the wheel. Then you turned left and it caused instability. Don’t you think your claim to have a reliable car is invalid?
Driver: You’re not supposed to remove the bloody wheels while we’re moving!
Removing a function at runtime (runtime being the programming equivalent of a car being in motion) that other functions rely on is usually a guaranteed way to break your program. Fortunately, statically-typed languages don’t allow you to do this. Changing the nature of a given f
Driver: What the hell? We seem to be crashing!
Passenger: I removed the front left wheel
Driver: You what?!
Passenger: I removed the wheel. Then you turned left and it caused instability. Don’t you think your claim to have a reliable car is invalid?
Driver: You’re not supposed to remove the bloody wheels while we’re moving!
Removing a function at runtime (runtime being the programming equivalent of a car being in motion) that other functions rely on is usually a guaranteed way to break your program. Fortunately, statically-typed languages don’t allow you to do this. Changing the nature of a given function at runtime would also break the referential transparency of any function that depended on it, because the dependent functions might then produce different results. Again, statically-typed languages protect us from that kind of foolishness.
Composing new functions at runtime is possible in such languages, on the other hand. But a) the basic function signature will be known in advance and b) the function won’t change once created. So that’s not a problem.
Dynamically-typed languages do tend to allow this kind of thing, which is one of the reasons that pure functional programming is rather difficult to guarantee in those languages. If you are using one of those languages to do functional programming, deleting existing functions from the dependency graph is high on the list of things you shouldn’t do.
First, let me point out that normalization procedures do not “decompose until you cannot further decompose”. They usually decompose until you reach the normal form that has the desired properties, but not further, and it is quite possible and even likely that in the highest normal form further decomposition is still possible, but not desirable. For example, a relation R(A, B, C) with functional dependencies A->B and A->C can be decomposed into R1(A, B) and R2(A, C), but R is already in BCNF so this is not required by BCNF normalization procedures.
With that that settled, let us get to the task
First, let me point out that normalization procedures do not “decompose until you cannot further decompose”. They usually decompose until you reach the normal form that has the desired properties, but not further, and it is quite possible and even likely that in the highest normal form further decomposition is still possible, but not desirable. For example, a relation R(A, B, C) with functional dependencies A->B and A->C can be decomposed into R1(A, B) and R2(A, C), but R is already in BCNF so this is not required by BCNF normalization procedures.
With that that settled, let us get to the task of normalizing this to BCNF. Let us name the dependencies:
FD1 : A -> CDE
FD2: ABGH -> FIJK
FD3: GHIJ -> ABF
First step: computing the candidate keys.
I will not repeat the algorithm, because you can easily find that elsewhere. In this case the candidate keys are: ABGH and GHIJ.
Second step: determining the current normal form.
The check for 1NF succeeds trivially, since we assume that R is a relation as defined by the relational model. The check for 2NF already fails for FD1 because A is not the superset of a candidate key, and in fact a proper subset of a candidate key. So the current relation is in 1NF only.
We will follow the normalization procedure that splits off violating dependencies into separate relations.
Third step: splitting of FD1. This means we create from R a relation R2 with all the attributes of the FD, and R1 which contains all the attributes of R minus those in the right-hand side of the FD. So our new schema becomes:
R1(A, B, F, G, H, I, J, K) and R2(A, C, D, E)
Fourth step: determine the candidate keys of the new relations. This is needed to check in what normal form the result is. The result of this is:
R1 has candidate keys: ABGH and GHIJ
R2 has candidate keys: A
NOTE: It is not correct to determine the keys in a schema with several relations by only considering the dependencies that contain only attributes from that relation. In this case it happens to produce the right answer, but does not always do so.
Fifth step: determine the normal form of the new relations. For each of R1 and R2 it holds that the local dependencies start from candidate keys, so both relations are in BCNF.
“Pure” functional languages are only pure with respect to some level of abstraction. It doesn’t matter what kind of guarantees your language gives if somebody pulls the power cord before your computation is finished¹. The real world is our eternal enemy². Language design, like law, is an adversarial system—a language can only be understood along with the context of what it can fight against and what it cannot.
A language’s being “pure” gives us guarantees about what you can do within the language that can be observed within the language. The meaning of “within the language” is built up on layer
“Pure” functional languages are only pure with respect to some level of abstraction. It doesn’t matter what kind of guarantees your language gives if somebody pulls the power cord before your computation is finished¹. The real world is our eternal enemy². Language design, like law, is an adversarial system—a language can only be understood along with the context of what it can fight against and what it cannot.
A language’s being “pure” gives us guarantees about what you can do within the language that can be observed within the language. The meaning of “within the language” is built up on layers and layers of abstraction; if you pierce any of these layers, all bets are off. This includes everything from making the computer architecture run differently³ (which you can achieve on real chips with too much voltage or insufficient cooling) or having the operating system break its own abstractions (threads, virtual memory…) to twiddling with the garbage collector, hooking up a debugger or running in profiling mode. All these factors can affect how a program written in the purest of languages actually runs but, crucially, these are all actions explicitly outside the language.
In practice, unless your language is formalized in terms of a well-defined model of computation, the line between “within the language” and “outside the language” can be a bit fuzzy. Different languages draw it in different places. A language’s level of abstraction may or may not cover things like termination, runtime errors, asymptotic time/space performance, memory allocation, or wall clock execution time. Most aspects of computation, however, clearly fall on one side or another. Languages explicitly depend on the meanings of primitive operations and constructs as well as explicit effects like mutable state and I/O, while not exposing deficiencies in hardware behavior or problems with the laws of physics.
One of the fundamental assumptions that languages rely on is that the code being executed does not change except in ways explicitly allowed by the language. If you are using a pure language, there are only two possibilities:
- a function is modified or removed using facilities explicitly exposed by the language
- a function is modified or removed through some outside method like an external process editing the program’s binary directly
We would expect these to result in different behavior from the language:
- if code can be modified within the language, this can be managed in the same way as any other kind of effect from mutability through external I/O—pure languages either disallow this completely or have an effect system like Haskell’s
IO
type to manage it - if code is modified outside the language, we’ve broken the fundamental abstraction on which everything is built; the program can now fail or behave in arbitrary ways without having any effect on whether the language is “pure”
There is no fundamental difference between mutable data and mutable code. The implementation of the two is different—especially on modern systems with a secure separation between executable and non-executable memory—but they are the same from a language design and semantics standpoint.
footnotes
¹ I can imagine pure distributed languages (Unison, perhaps?) which have guarantees for what happens if a subset of the machines they are running on fail. But you’re still screwed if somebody pulls all the plugs or if WWIII starts and all your data centers get nuked.
² Along with hardware companies, hardware, hardware drivers, operating systems, other software, the NSA and anybody writing real programs in our language.
³ If your physical computer doesn’t behave the way it should, well, there isn’t much you can do. You can try to compensate for hardware issues in software but anything you do is limited and it’s damn hard. People have actually explored using robust software to work around instability in hardware designs, but the approach has practical issues. In the wise words of James Mickens:
He discovered several papers that described software-assisted hardware recovery. The basic idea was simple: if hardware suffers more transient failures as it gets smaller, why not allow software to detect erroneous computations and re-execute them? This idea seemed promising until John realized THAT IT WAS THE WORST IDEA EVER. Modern software barely works when the hardware is correct, so relying on software to correct hardware errors is like asking Godzilla to prevent Mega-Godzilla from terrorizing Japan. THIS DOES NOT LEAD TO RISING PROPERTY VALUES IN TOKYO.
Here’s the thing: I wish I had known these money secrets sooner. They’ve helped so many people save hundreds, secure their family’s future, and grow their bank accounts—myself included.
And honestly? Putting them to use was way easier than I expected. I bet you can knock out at least three or four of these right now—yes, even from your phone.
Don’t wait like I did. Go ahead and start using these money secrets today!
1. Cancel Your Car Insurance
You might not even realize it, but your car insurance company is probably overcharging you. In fact, they’re kind of counting on you not noticing. Luckily,
Here’s the thing: I wish I had known these money secrets sooner. They’ve helped so many people save hundreds, secure their family’s future, and grow their bank accounts—myself included.
And honestly? Putting them to use was way easier than I expected. I bet you can knock out at least three or four of these right now—yes, even from your phone.
Don’t wait like I did. Go ahead and start using these money secrets today!
1. Cancel Your Car Insurance
You might not even realize it, but your car insurance company is probably overcharging you. In fact, they’re kind of counting on you not noticing. Luckily, this problem is easy to fix.
Don’t waste your time browsing insurance sites for a better deal. A company called Insurify shows you all your options at once — people who do this save up to $996 per year.
If you tell them a bit about yourself and your vehicle, they’ll send you personalized quotes so you can compare them and find the best one for you.
Tired of overpaying for car insurance? It takes just five minutes to compare your options with Insurify and see how much you could save on car insurance.
2. Ask This Company to Get a Big Chunk of Your Debt Forgiven
A company called National Debt Relief could convince your lenders to simply get rid of a big chunk of what you owe. No bankruptcy, no loans — you don’t even need to have good credit.
If you owe at least $10,000 in unsecured debt (credit card debt, personal loans, medical bills, etc.), National Debt Relief’s experts will build you a monthly payment plan. As your payments add up, they negotiate with your creditors to reduce the amount you owe. You then pay off the rest in a lump sum.
On average, you could become debt-free within 24 to 48 months. It takes less than a minute to sign up and see how much debt you could get rid of.
3. You Can Become a Real Estate Investor for as Little as $10
Take a look at some of the world’s wealthiest people. What do they have in common? Many invest in large private real estate deals. And here’s the thing: There’s no reason you can’t, too — for as little as $10.
An investment called the Fundrise Flagship Fund lets you get started in the world of real estate by giving you access to a low-cost, diversified portfolio of private real estate. The best part? You don’t have to be the landlord. The Flagship Fund does all the heavy lifting.
With an initial investment as low as $10, your money will be invested in the Fund, which already owns more than $1 billion worth of real estate around the country, from apartment complexes to the thriving housing rental market to larger last-mile e-commerce logistics centers.
Want to invest more? Many investors choose to invest $1,000 or more. This is a Fund that can fit any type of investor’s needs. Once invested, you can track your performance from your phone and watch as properties are acquired, improved, and operated. As properties generate cash flow, you could earn money through quarterly dividend payments. And over time, you could earn money off the potential appreciation of the properties.
So if you want to get started in the world of real-estate investing, it takes just a few minutes to sign up and create an account with the Fundrise Flagship Fund.
This is a paid advertisement. Carefully consider the investment objectives, risks, charges and expenses of the Fundrise Real Estate Fund before investing. This and other information can be found in the Fund’s prospectus. Read them carefully before investing.
4. Earn Up to $50 this Month By Answering Survey Questions About the News — It’s Anonymous
The news is a heated subject these days. It’s hard not to have an opinion on it.
Good news: A website called YouGov will pay you up to $50 or more this month just to answer survey questions about politics, the economy, and other hot news topics.
Plus, it’s totally anonymous, so no one will judge you for that hot take.
When you take a quick survey (some are less than three minutes), you’ll earn points you can exchange for up to $50 in cash or gift cards to places like Walmart and Amazon. Plus, Penny Hoarder readers will get an extra 500 points for registering and another 1,000 points after completing their first survey.
It takes just a few minutes to sign up and take your first survey, and you’ll receive your points immediately.
5. Get Up to $300 Just for Setting Up Direct Deposit With This Account
If you bank at a traditional brick-and-mortar bank, your money probably isn’t growing much (c’mon, 0.40% is basically nothing).
But there’s good news: With SoFi Checking and Savings (member FDIC), you stand to gain up to a hefty 3.80% APY on savings when you set up a direct deposit or have $5,000 or more in Qualifying Deposits and 0.50% APY on checking balances — savings APY is 10 times more than the national average.
Right now, a direct deposit of at least $1K not only sets you up for higher returns but also brings you closer to earning up to a $300 welcome bonus (terms apply).
You can easily deposit checks via your phone’s camera, transfer funds, and get customer service via chat or phone call. There are no account fees, no monthly fees and no overdraft fees. And your money is FDIC insured (up to $3M of additional FDIC insurance through the SoFi Insured Deposit Program).
It’s quick and easy to open an account with SoFi Checking and Savings (member FDIC) and watch your money grow faster than ever.
Read Disclaimer
5. Stop Paying Your Credit Card Company
If you have credit card debt, you know. The anxiety, the interest rates, the fear you’re never going to escape… but a website called AmONE wants to help.
If you owe your credit card companies $100,000 or less, AmONE will match you with a low-interest loan you can use to pay off every single one of your balances.
The benefit? You’ll be left with one bill to pay each month. And because personal loans have lower interest rates (AmONE rates start at 6.40% APR), you’ll get out of debt that much faster.
It takes less than a minute and just 10 questions to see what loans you qualify for.
6. Lock In Affordable Term Life Insurance in Minutes.
Let’s be honest—life insurance probably isn’t on your list of fun things to research. But locking in a policy now could mean huge peace of mind for your family down the road. And getting covered is actually a lot easier than you might think.
With Best Money’s term life insurance marketplace, you can compare top-rated policies in minutes and find coverage that works for you. No long phone calls. No confusing paperwork. Just straightforward quotes, starting at just $7 a month, from trusted providers so you can make an informed decision.
The best part? You’re in control. Answer a few quick questions, see your options, get coverage up to $3 million, and choose the coverage that fits your life and budget—on your terms.
You already protect your car, your home, even your phone. Why not make sure your family’s financial future is covered, too? Compare term life insurance rates with Best Money today and find a policy that fits.
Side effects are about runtime behaviours. Removing code is at compile time, and in this case would cause the code to not compile at all.
In general the existence of functional dependencies is regarded as a Bad Thing. They may be momentarily useful, but are almost guaranteed to bite your bum at the most inopportune moment, such as when you’re racing to meet a deadline.
In the ideal world, functional dependencies do not exist. In the real world, sometimes they are unavoidable. That said, you should strive to eliminate as many occurrences as possible, and in those cases remaining, ensure that the source header documents the dependencies thoroughly.
A lot of coders hate writing docs. That is because they approach the problem backward
In general the existence of functional dependencies is regarded as a Bad Thing. They may be momentarily useful, but are almost guaranteed to bite your bum at the most inopportune moment, such as when you’re racing to meet a deadline.
In the ideal world, functional dependencies do not exist. In the real world, sometimes they are unavoidable. That said, you should strive to eliminate as many occurrences as possible, and in those cases remaining, ensure that the source header documents the dependencies thoroughly.
A lot of coders hate writing docs. That is because they approach the problem backwards. They should write the docs first, then write the code, and finally amend the docs to suit deviations the code took from the original spec.
A very good question, very important in practice, and often neglected in academic database classes because it is something that is hard and not so much fun to teach.
First note that there is of course no method that can guarantee a correct and complete result. We are just talking here about methods and heuristics that can help you find many of the dependencies in most of the cases in practice, but there is no guarantee that there will be no false positives or false negatives. Having said that, I will discuss two ways of looking for dependencies.
Method 1: Mining Example Instances of the Relation
A very good question, very important in practice, and often neglected in academic database classes because it is something that is hard and not so much fun to teach.
First note that there is of course no method that can guarantee a correct and complete result. We are just talking here about methods and heuristics that can help you find many of the dependencies in most of the cases in practice, but there is no guarantee that there will be no false positives or false negatives. Having said that, I will discuss two ways of looking for dependencies.
Method 1: Mining Example Instances of the Relation
Take one or more examples of instance of the relation and see which dependencies happen to hold there. Let us say, for example, we have the following (abstract) instance of a relation:
- A B C D
- -----------
- a1 b1 c1 d1
- a1 b1 c1 d1
- a2 b1 c1 d2
- a1 b2 c1 d2
You can check which FDs hold in this instance, and you can even automate this. For example, the FD A -> B can be checked for table R with the SQL query:
- SELECT A
- FROM R
- GROUP BY A
- HAVING COUNT (DISTINCT B) > 1;
If any A values are returned, these violate the FD since they have more than one B value associated with them. If the result is empty then the FD holds. You can repeat this for all potential FDs , and determine which ones hold for this particular instance. In this case this includes the FDs AB->D and B->C. You ideally should repeat this for several representative instances, and then maintain only those dependencies that hold in all of them. Obviously this is a lot of work and can and should be automated. Also keep in mind that your set of FDs is likely to be redundant since it will include trival FDs and FDs that would follow logically from a subset of the found FDs. For example, in the given example you would also find AB->C, which follows from B->C.
Method 2: Entity-Relationship Analysis
This approach is the more practical one, but relies on your ER-modelling skills. It is based on determining the Entities, Relationships and Attributes that are modelled within the relation. Essentially you are making an ER model of all information in the relation under analysis. For illustration consider the following example where we have a relation with the following header.
- (StudName, StudNr, StudAddr, CourseNr,
- CourseName, Semester, Year, ProfName, Grade)
This describes students, with their name, student number and address. It also describes courses, also with name and number, and editions of these courses in a particular year and semester. Finally it also contains the relationship between an edition of a course and the professor(s) teaching it. Other presented relationships are the one between students and course editions, with the obtained grade as an attribute of that relationship. Finally, there is the relationship between the edition of a course and the professors teaching it.
So how do we get the FDs? The first step is to identify the Entity Types, the sets of columns that identify them (there might be multiple) and their attributes. In this case:
- Student: {StudName}, {StudNR}
- attributes: StudAddr
- Course: {CourseNr}, {CourseName}
- Course Edition: {CourseNr, Semester, Year}
- Professor: {ProfName}
From this we can derive FDs with the following rules:
(ER2FD1) If an Entity Type has keys K1 and K2, then the FD K1 -> K2 holds
(ER2FD2) If an Entity Type has a key K and single-valued attribute A then FD K -> A holds
So in this case we derive:
- StudName -> StudNR (ER2FD1)
- StudNr -> StudName (ER2FD1)
- StudNR -> StudAddr (ER2FD2)
- CourseNr -> CourseName (ER2FD1)
- CourseName -> CourseNr (ER2FD1)
The second step is to identify the Relationships, between which Entity Types they hold, and what attributes they have:
- Student-followed-Course-edition: (Student, Course Edition)
- attributes: Grade
- Prof-teaches-Course-edition: (Professor, Course Edition)
From this we derive FDs with the following rules:
(ER2FD3) If a Relationship is one-to-many or one-to-one, then there holds an FD from one of the keys of the many-Entity to one of the keys of the one-Entity.
(ER2FD4) If a Relationship has a single-valued attribute, then there holds an FD from a combination of the keys of the participating Entity Types to the attribute.
So in this case we derive:
- StudNr, CourseNr, Semester, Year -> Grade (ER2FD4)
- CourseNr, Semester, Year -> ProfName (ER2FD3)
Note: We assume here that each edition only has one professor, and so Prof-teaches-Course-Edition is indeed one-to-many.
For ER2FD3 and ER2FD4 it is sufficient that this is done for only one combination of keys, since the others are implied. So we could, but do not also derive the following FDs:
- StudName, CourseNr, Semester, Year -> Grade
- StudNr, CourseName, Semester, Year -> Grade
- StudName, CourseName, Semester, Year -> Grade
The rule ER2FD3 also has a variant for n-ary relationships where n>2, which is somewhat more complex. Consider, for example, a relationship that holds between Entity Types A, B and C. Then it should be checked if perhaps one of the participating Entity Types, say C, is functionally determined by the two others, i.e., if for every combination of A entity and B entity there is at most one C entity in this relationship with them. If that is the case, then an FD should be derived from a combination of keys of A and keys of B to the keys of C. An example of this would be a relation Supplies(Supplier, Part, Project) where each Project has for each Part at most one Supplier.
Your question could be rephrased, “is functional dependency symmetric?”
The answer is no in general.
There are cases in which A and B are each F.D. for each other:
- A and B are identical sets of attributes (that is, A is a subset of B and B is a subset of A).
- A and B are both individually unique in the relation (that is, they are not the same set of attributes, but they are both candidate keys). For each value in A, there can be exactly one value in B, and vice-versa.
But in general, functional dependency means that given a value of A, you can identify the row, and therefore you can unambiguously ge
Your question could be rephrased, “is functional dependency symmetric?”
The answer is no in general.
There are cases in which A and B are each F.D. for each other:
- A and B are identical sets of attributes (that is, A is a subset of B and B is a subset of A).
- A and B are both individually unique in the relation (that is, they are not the same set of attributes, but they are both candidate keys). For each value in A, there can be exactly one value in B, and vice-versa.
But in general, functional dependency means that given a value of A, you can identify the row, and therefore you can unambiguously get the value of B in the same row.
If B is not a candidate key, and is not the same set of attributes as A, then there can be multiple rows with the same value of B for any given value of A.
Example: Name -> Social Security Number
Assume Social Security Number is a unique column, i.e. a candidate key. Each person has a unique SSN. Therefore if you know the SSN, you can get the person’s name in the respective row.
But Name is not a unique column. There can be multiple people with the same name, and each has a different SSN. Given a name, you cannot unambiguously know the SSN for a person with that name.
The best way to find the right freelancer for digital marketing is on Fiverr. The platform has an entire category of professional freelancers who provide full web creation, Shopify marketing, Dropshipping, and any other digital marketing-related services you may need. Fiverr freelancers can also do customization, BigCommerce, and Magento 2. Any digital marketing help you need just go to Fiverr.com and find what you’re looking for.
This terminology has nothing to do with functional programming or programming languages. Transitive functional dependencies arise in relational databases.
Let [math]R[/math] be a relation over a family of sets [math]\{ A_1, \ldots, A_k \}[/math], that is, [math]R \subset A_1 \cdots A_k[/math] – we call these sets attributes. Now suppose [math]X \subset \{ A_1, \ldots, A_k \}[/math] is a subfamily of attributes and [math]Y[/math] is one of the attributes in [math]\{ A_1, \ldots, A_k \}[/math]. Then we say that [math]X[/math] functionally determines [math]Y[/math] in [math]R[/math] if whenever we have two tuples in [math]R[/math] with the same values for the attributes in [math]X[/math], then they also have the same value for the attrib
This terminology has nothing to do with functional programming or programming languages. Transitive functional dependencies arise in relational databases.
Let [math]R[/math] be a relation over a family of sets [math]\{ A_1, \ldots, A_k \}[/math], that is, [math]R \subset A_1 \cdots A_k[/math] – we call these sets attributes. Now suppose [math]X \subset \{ A_1, \ldots, A_k \}[/math] is a subfamily of attributes and [math]Y[/math] is one of the attributes in [math]\{ A_1, \ldots, A_k \}[/math]. Then we say that [math]X[/math] functionally determines [math]Y[/math] in [math]R[/math] if whenever we have two tuples in [math]R[/math] with the same values for the attributes in [math]X[/math], then they also have the same value for the attribute [math]Y[/math]. In other words, the values of the attributes in [math]X [/math]uniquely determinedly the value of the attribute [math]Y[/math]. Thus, when restricted to [math]X[/math], [math]R[/math] can be thought of as a function from the Cartesian product of the sets in [math]X[/math] to [math]Y[/math]. This is why one speaks of functional dependencies.
A simple example is a relation whose attributes are
- [math]N: [/math]Name of person
- [math]D: [/math]Date of birth
- [math]A: [/math]Address
Clearly, [math]N[/math] functionally determines [math]D[/math] – any person can only be born once.
A transitive functional dependency is a functional dependency that comes from the transitive closure of the “functionally determines” relation. If [math]A[/math] functionally determines [math]B[/math] (and [math]B[/math] does not functionally determine [math]A[/math]) and [math]B[/math] functionally determines [math]C[/math], then [math]A [/math]functionally determines [math]C[/math].
This is how i would do it, and i'll try my best to be clear in explaining it.
Let me know if you have further questions.
Problem: you have People(User) with Properties for Rental to other People(also a User).
So we have three tables USERS, PROPERTIES and RENTS/RENTALS, and they're related to each other.
Users ( they can either be a costumer or owner of a property or both).
Properties (Users can have many Properties, so the relation is 1:N ).
Rentals/Rents ( User(customer) can rent Properties, 1:N and Properties are available for Renting/Rentals 1:N).
I drew a scheme, hope it helps out:
This is how i would do it, and i'll try my best to be clear in explaining it.
Let me know if you have further questions.
Problem: you have People(User) with Properties for Rental to other People(also a User).
So we have three tables USERS, PROPERTIES and RENTS/RENTALS, and they're related to each other.
Users ( they can either be a costumer or owner of a property or both).
Properties (Users can have many Properties, so the relation is 1:N ).
Rentals/Rents ( User(customer) can rent Properties, 1:N and Properties are available for Renting/Rentals 1:N).
I drew a scheme, hope it helps out:
You are not missing anything. Heath’s theorem only states that your decomposition will be lossless, but not that it will be dependency preserving. Indeed, it can be possible that among all the decompositions that would be possible by Heath’s theorem, none is actually dependency preserving. Consider for example the canonical example for the difference between 3NF and BCNF:
R(A, B, C) with F ={ AB -> C, C -> B }
Note that the candidate keys are: AB, AC.
It is in 3NF, but not in BCNF, since we have an FD C -> B where C is not a superkey. But splitting of that dependency will make you loose the depen
You are not missing anything. Heath’s theorem only states that your decomposition will be lossless, but not that it will be dependency preserving. Indeed, it can be possible that among all the decompositions that would be possible by Heath’s theorem, none is actually dependency preserving. Consider for example the canonical example for the difference between 3NF and BCNF:
R(A, B, C) with F ={ AB -> C, C -> B }
Note that the candidate keys are: AB, AC.
It is in 3NF, but not in BCNF, since we have an FD C -> B where C is not a superkey. But splitting of that dependency will make you loose the dependency AB -> C.
Also note that Heath’s theorem does not tell you when to stop. Consider the following schema:
R(A, B, C) with F = { A -> B, A -> C }
You can split this according to Heath’s theorem, but is in fact already in BCNF, so splitting this further would not remove any redundancy.
It someone depends on the associated risks. If it’s in production and not bothering anyone, then cleaning it up has to add enough value that it overcomes the risks of touching it and introducing bugs. If you’re just nitpicking and want to add whitespace or reformat comments, then no. If there is some phenomenon or outright error in production that you’re trying to triage/investigate and the only way to understand this code or compartmentalize what is happening is to [incrementally?] refactor the code, then do what you have to do.
There’s also a case to be made for refactoring this if it’s consi
It someone depends on the associated risks. If it’s in production and not bothering anyone, then cleaning it up has to add enough value that it overcomes the risks of touching it and introducing bugs. If you’re just nitpicking and want to add whitespace or reformat comments, then no. If there is some phenomenon or outright error in production that you’re trying to triage/investigate and the only way to understand this code or compartmentalize what is happening is to [incrementally?] refactor the code, then do what you have to do.
There’s also a case to be made for refactoring this if it’s considered to be technical debt by the team. If people are worried that there are bugs or dragons hidden within and there is a desire to do a preemptive strike on the code before it negatively effects production, then that’s the responsible thing to do.
Note that unit-tests play a big part here. Unit-tests are an indispensable tool to allow us to sometimes make or experiment with high-risk, dramatic changes to sensitive code from development and get a very reasonable gauge of the likeliness of breaking production. With excellent coverage, you can be reasonably certain that production is safe, but, even with “good” coverage, you can tell whether you can make a quick change and have them be good or whether, if after five successive waves of changes, you’re still struggling with weird issues that keep taking different forms and you should just circle back some other time. As engineers, our job is to gauge effort and risk, and unit-tests are a very big gun to have in your holster, to be used to gauge the ferocity of the unknown.
To check if the sets [math]S_1[/math] and [math]S_2[/math] of functional dependencies are equivalent you can check if every dependency in S1 logically follows from the dependencies in [math]S_2[/math], and vice versa.
Alternatively, you could check if [math]S_1^+=S_2^+[/math] where [math]S_1^+[/math] and [math]S_2^+[/math] are the closures of [math]S_1[/math] and [math]S_2[/math] (so the set of all dependencies that logically follow). It holds that [math]S_1[/math] and [math]S_2[/math] are equivalent if, and only if, [math]S_1^+=S_2^+[/math]. Note that [math]S_1^+[/math] and [math]S_2^+[/math] can get very large, but are in fact finite, so this can be an effective algorithm.
One possible way of checking if [math]X \to Y[/math] logically follows from a set of dependencies [math]S[/math]
To check if the sets [math]S_1[/math] and [math]S_2[/math] of functional dependencies are equivalent you can check if every dependency in S1 logically follows from the dependencies in [math]S_2[/math], and vice versa.
Alternatively, you could check if [math]S_1^+=S_2^+[/math] where [math]S_1^+[/math] and [math]S_2^+[/math] are the closures of [math]S_1[/math] and [math]S_2[/math] (so the set of all dependencies that logically follow). It holds that [math]S_1[/math] and [math]S_2[/math] are equivalent if, and only if, [math]S_1^+=S_2^+[/math]. Note that [math]S_1^+[/math] and [math]S_2^+[/math] can get very large, but are in fact finite, so this can be an effective algorithm.
One possible way of checking if [math]X \to Y[/math] logically follows from a set of dependencies [math]S[/math] can be done by (1) computing the completion [math]X^+[/math] under [math]S[/math], i.e., the set of all attributes that functionally depend on [math]X[/math], and (2) checking if [math]Y[/math] is a subset of [math]X^+[/math]. If (2) holds then [math]X \to Y[/math] logically follows from [math]S[/math], if not, then not.
A search of Google on 01 11 2018 @ 13 52 hrs for keywords functional dependency in normalization has just revealed 881,000 responses.
These responses include:
- DBMS Normalization
- Functional dependency - Wikipedia
- http://www.ict.griffith.edu.au/~jw/normalization/assets/Functional%20Dependencies%20and%20Normalization.pdf
Which you could, and should, consult for your homework. Alternatively, look at the six answers at What is functional dependency in DBMS and what are some examples of it?
If it’s described as a “normalized” database I’d expect it to meet all - not most - requirements of 3NF. That’s the minimum.
if in C you are creating circular dependencies, means your design is flawled. Unless you are doing it on purpose (like for example several kind of simulation systems that have feedback loops on themselves).
Even so, the fact you want to avoid them seems its not what you want, so i just will say You need to have a good design from the start. and not just throw a bunch of parameters and say “I fix it later”.
A->B
1)A functionally determines B
Or
2)B is functionally dependant on A
Given the value of A you will be able to uniquely identify B. A&B can be any subset of attributes.
Let's workout some examples
If we have a table with two attributes A&B
If T1(A)=T2(A) then
T1(B)=T2(B) where T1 &T2 are two tuples
Here a will always be associated with 1 & b with 2
If we have a table like this
We see that A->B. We also see that whenever A is repeating B is also repeating .This is data redundancy. So we delete attribute B and create a new table with attributes A &B . The attribute or attributes on left hand side (LHS)
A->B
1)A functionally determines B
Or
2)B is functionally dependant on A
Given the value of A you will be able to uniquely identify B. A&B can be any subset of attributes.
Let's workout some examples
If we have a table with two attributes A&B
If T1(A)=T2(A) then
T1(B)=T2(B) where T1 &T2 are two tuples
Here a will always be associated with 1 & b with 2
If we have a table like this
We see that A->B. We also see that whenever A is repeating B is also repeating .This is data redundancy. So we delete attribute B and create a new table with attributes A &B . The attribute or attributes on left hand side (LHS) of A->B here A will act as primary key in new table.
Let's take a relation which does not satisfies Functional dependency.
B->C here we see that we have two different values of C for single value of B
A functional dependency is a particular type of database constraint, i.e., a restriction that should hold for an instance of a particular database schema if that instance is to be considered valid.
Specifically a functional dependency states that within a particular relation R a set of columns {A1, .., An} functionally determines a column B . This is usually denoted as A1 .. An -> B. The exact meaning of this is that in any valid instance of R it must hold that if two tuples / records agree on their values for all of A1, ..., An, then they must also agree on the value for B.
For example, assume
A functional dependency is a particular type of database constraint, i.e., a restriction that should hold for an instance of a particular database schema if that instance is to be considered valid.
Specifically a functional dependency states that within a particular relation R a set of columns {A1, .., An} functionally determines a column B . This is usually denoted as A1 .. An -> B. The exact meaning of this is that in any valid instance of R it must hold that if two tuples / records agree on their values for all of A1, ..., An, then they must also agree on the value for B.
For example, assume R has columns {A, B, C, D}, then the functional dependency A B -> D states that if two tuples have the same A value and the same B value, then they also must have the same D value. The following instance of R satisfies this:
- A B C D
- -------
- 1 2 3 4
- 1 2 5 4
- 1 3 2 3
- 1 3 3 3
As you can see, all tuples with values (1, 2) for (A, B) agree on the value (4) for (D), and all tuples with values (1, 3) for (A, B) agree on the value (3) for (D).
An example of an instance that does not satisfy A B -> D is:
- A B C D
- -------
- 1 2 3 4
- 1 2 5 6
Here we have two tuples that agree on (A, B) but not on (D).
There can be several reasons why a functional dependency might hold for a particular relation.
One is that that the value in the dependent column can be computed or derived from the columns on which it depends. For example, the age of somebody can be derived from his or her birth date.
Another more common reason is that the dependent column describes a property of some entity that plays a role in the described relationship and is identified by the attributes on which it is dependent. For example, consider a relation DogOwners(OwnersID, DogID, OwnersAddress) where OwnersID identifies an dog owner, DogID identifies a dog of the owner and OwnersAddress is the address of the owner. Assume that the relation will contain a record for each dog a person owns. Then the address of the owner will be repeated for each dog owned, but it will for a particular owner always be the same. Thus, if two records agree on the OwnersName then they also agree on the OwnersAddress, and so the functional dependency OwnersID -> OwnersAddress holds.
Of course, the latter case is clearly a badly designed relation and causes unnecessary redundancy. It is the theory of database normalization, where functional dependencies play a key role, that explains how such redundancy is caused by certain combinations of functional dependencies and how this can be resolved.
No, you cannot delete the primary key from one table without removing all the dependencies that other tables have on that key. Even if you try to do that, an error will be raised which will not let you do so. So either you can delete the rows in other tables which depend on that column, i.e the primary key or change the key association for that key.
They are usually written out with the determining attribute(s) on the left and the dependent attribute(s) on the right with an arrow between them designating that given a value on the left a value on the right can be determined.
Here are some examples:
AB → CDE
ClientID → ClientName, ClientAddress
StateCode → StateName, TotalPopulation
Functional dependencies are a form of integrity constraint in relational databases. Integrity constraints are there to promote data correctness and consistency which ultimately means that the database can be queried (when certain data are requested by a user) efficiently. When creating database schema (the description of a database when it is being designed) we need know where functional dependenc
Functional dependencies are a form of integrity constraint in relational databases. Integrity constraints are there to promote data correctness and consistency which ultimately means that the database can be queried (when certain data are requested by a user) efficiently. When creating database schema (the description of a database when it is being designed) we need know where functional dependencies exist in order to create “good” database models. Good database models are where data redundancy (repetition of data) is minimised. By minimising data dependency we reduce the number of anomalies that may occur when the database is used. Functionality dependency means that an attribute in a relation (AKA a column in a table) is dependent on anot...
As a human brain owner, I like to use the example of rationality and imagination being given individual powers as hemispheres in relation to dependency balancing. To see this relation better consider how each eye can almost see exactly what the other sees but NOT what they can see together, a third dimension. Is that the normal dimension of dependency? Is that self care system in relation to the need for care / dependency to survive the infancy stage?
Depends (could not help myself).
If you have the time and knowledge on how exactly to address all issues in a project and you are sure on stability and performance then by all means yes, having no dependency is the best way!!
Now if that is possible?
Unless you are creating a hardware platform from scratch and you are willing to write Basic Input Output System (BIOS) and then an Operating System and then all the required drivers (should you decide to go with modular kernel architecture) then an assembler and then a new compiler for at least a mid-to-low-level language (and so on and so forth), yo
Depends (could not help myself).
If you have the time and knowledge on how exactly to address all issues in a project and you are sure on stability and performance then by all means yes, having no dependency is the best way!!
Now if that is possible?
Unless you are creating a hardware platform from scratch and you are willing to write Basic Input Output System (BIOS) and then an Operating System and then all the required drivers (should you decide to go with modular kernel architecture) then an assembler and then a new compiler for at least a mid-to-low-level language (and so on and so forth), you will have to accept that parts of your code are by definition depended on code created by others.
In theory you can do all the above, of course not solo. Plus you will have to make available a serious budget.
So reality check: Define “Dependency”, estimate the trade-off(s) against already available code-base (do you really need to re-write Linux Kernel / Widows HAL etc). In most cases programmers refer to dependency as an include / import from a library (open / closed source no matter). If this is the actual query I will respond as follows: a library is a tool, so if you need it and you know how and when and why to use it, you will save time, budget and most probably will get a better result. As with any tool take a look at libraries’ reputation and comments / open issues by other users / developers. This should provide sufficient info to make the next step and test the tool stressing it to at least 10 times the load you have been told you need to handle. If your tests are considered successful, go for the lib, otherwise you may end-up with a never-ending-story (project infinity).
I agree with Richard Rombouts . Functional dependencies differ from framework to framework. Are you asking functional dependencies of a relation?? if so
A functional dependency (FD) on a relation schema R is a constraint X → Y, where X and Y are subsets of attributes of R.
Explanation: an FD is a relationship between an attribute "Y" and a determinant (1 or more other attributes) "X" such that for a given value of a determinant the value of the attribute is uniquely defined.
- X is a determinant
- X determines Y
- Y is functionally dependent on X
- X → Y
- X →Y is trivial if Y ⊆ X
Definition: An FD X → Y is s
I agree with Richard Rombouts . Functional dependencies differ from framework to framework. Are you asking functional dependencies of a relation?? if so
A functional dependency (FD) on a relation schema R is a constraint X → Y, where X and Y are subsets of attributes of R.
Explanation: an FD is a relationship between an attribute "Y" and a determinant (1 or more other attributes) "X" such that for a given value of a determinant the value of the attribute is uniquely defined.
- X is a determinant
- X determines Y
- Y is functionally dependent on X
- X → Y
- X →Y is trivial if Y ⊆ X
Definition: An FD X → Y is satisfied in an instance r of R if for every pair of tuples, t and s: if t and s agree on all attributes in X then they must agree on all attributes in Y
A key constraint is a special kind of functional dependency: all attributes of relation occur on the right-hand side of the FD:
- SSN → SSN, Name, Address
Reference : Functional Dependencies
This is often deduced before a table is designed, just by knowledge of the data source.
But suppose the data is loaded in an SQL table without a primary key and we wish to deduce whether column A is functionally dependent on column B. Here’s one way:
select count(distinct B) from table;
select count(*) from (select distinct A,B from table) as t(A,B);
The first query gives the count of distinct values of column B. The second query gives the count of distinct values of tuples (A,B). We know that the latter is at least the former, because every distinct value of B will give rise to a different value
This is often deduced before a table is designed, just by knowledge of the data source.
But suppose the data is loaded in an SQL table without a primary key and we wish to deduce whether column A is functionally dependent on column B. Here’s one way:
select count(distinct B) from table;
select count(*) from (select distinct A,B from table) as t(A,B);
The first query gives the count of distinct values of column B. The second query gives the count of distinct values of tuples (A,B). We know that the latter is at least the former, because every distinct value of B will give rise to a different value of a tuple (A,B). If they are equal, though, we know there is at most one value of A for each value of B. Therefore, for the data in the table at least, we know that A depends on B.
Of course that is no guarantee that later rows added to the table would break this dependency.
Yes, you can. But you need to delete the foreign key constraint first in the database.
Without the relationship constraints, you can pretty much drop the entire table containing the primary key as there are no more dependencies.
But any future ETL data loads will not work.
To delete the foreign key rows along with the primary key rows, you need to use ON DELETE CASCADE.
P.S. - Horrified that only 1 out of 5 software engineers got this answer right.
This answer assumes the reader understands what functional dependencies are. If that is not the case, view this Quora thread for some background information first.
So what are their uses?
Functional dependencies are used in the design (or redesign) of relational databases to help eliminate redundancy (data duplication), therefore reducing the possibility of update anomalies.
Redundancy is eliminated through a process called normalization.
If a database schema is properly normalized, the following should hold true for all tables: all columns should be functionally dependent on the table’s primary k
This answer assumes the reader understands what functional dependencies are. If that is not the case, view this Quora thread for some background information first.
So what are their uses?
Functional dependencies are used in the design (or redesign) of relational databases to help eliminate redundancy (data duplication), therefore reducing the possibility of update anomalies.
Redundancy is eliminated through a process called normalization.
If a database schema is properly normalized, the following should hold true for all tables: all columns should be functionally dependent on the table’s primary key. Functional dependencies allow you to verify that this is true and if it is not, determine the steps to take to normalize your tables so that it will be true (without losing any data or losing any connections between data that is related).
The normalization process uses functional dependencies to seek out and eliminate redundancy in a database schema, thereby reducing the possibility of update anomalies.
If a database schema is properly normalized, the following should hold true for all tables: all columns should be functionally dependent on the table’s primary key.
Functional dependencies allow you to verify that this is true an...
As per the question there are two things that I would like to discuss. Either you want to:
- delete (remove) Primary Key Constraint, OR
- delete (remove) the Primary Key Column(s)
Neither case is possible without changing the Foreign Key Constraint, since if we allow any of the above two cases then after that the Foreign Key would be left with no reference and that will violate the requirement of the Foreign Key Constraint.
If at all you want to perform either of the above and allow necessary changes with Foreign Key then it can be done using Cascade option.
From Google search: In relational database theory, a functional dependency is a constraint between two sets of attributes in a relation from a database. In Database Management System, a transitive dependency is a functional dependency that holds by virtue of transitivity.
Check this video for better understanding