NOTE: The Question has been updated. View Edit Revisions to view original question.
The scenario. An animal charity that at the moment, track their establishment's costs via a spreadsheet like so:
The above table is already in 1NF because it abides to the definition of 1NF.
First Normal Form: A relation in which the intersection of each row and column contains one and only one value.
After reading Catcall's answer I can see that it is in determining my dependencies that I messed up. All I did originally was exactly like Catcall said ! added a primary key column, and said to myself "there, that fixes that!"
So obviously that was wrong. I have now read more carefully into functional dependencies and in this book I have, it defines them as:
Functional Dependency: Describes the relationship between attributes in a relation. For example if A and B are attributes of relation R, and B is functionally dependent on A (denoted by A --> B), if each value of A is associated with exactly one value of B. There exists a functional dependency.
Keeping the above definition in mind, and examining my now expanded (more data) sample table, I can see that PetHouse Ltd is not always going to be associated with Dog food, and this breaks the part of definition about A being associated with EXACTLY one value of B.
So I guess in reality I am stuck here in identifying my functional dependencies. Here I am a little bit in the dark as I've never worked with a composite key that was made up of three different columns, but I'll go ahead anyway and see where I get to.
Catcall suggested using 3 columns [Name, BoughtFrom, TimeBought] as identifiers of data (i.e. a composite key for the table that is made up of 3 columns) and that makes sense as that would uniquely identify each row of data in the table. So the notation for the relation becomes:
IncuredCosts (Name, BoughtFrom, TimeBought, Cost)
The book in my possession also has this interesting part about the functional dependencies we need for normalization. It states that the functional dependencies we are after must have the following characteristics:
- There is a one-to-one relationship between the attribute(s) on the left-hand side (determinant) and those on the right-hand side of a functional dependency. (Note that the relationship in the opposite direction can be a one-to-one or one-to-many relationship.)
- They hold for all time.
- The determinant has the minimal number of attributes necessary to maintain the dependency with the attribute(s) on the right-hand side. In other words, there must be a full functional dependency between the attribute(s) on the left-hand and right-hand sides of the dependency.
I believe all the above characteristics hold true for this functional dependency:
(Name, BoughtFrom, TimeBought) --> Cost
Now then, Transitive Dependencies, which in the book (could be wrong like Catcall said) is defined as:
Transitive Dependency: A condition where A, B and C are attributes of a relation such that if A --> B and B --> C, then C is said to be transitively dependent on A via B (provided that A is not functionally dependent on B or C).
Am I right in thinking that my relationship as defined earlier does not have any transitive dependencies? But then again, if that the case, it would imply that I have reached 3NF! cause apparently the major step to 3NF is the removal of Transitive Dependencies into their own relation.
Have I really reached 3NF?
Thank you by the way. I learnt a lot through this post.