RainLover
VIP From a land downunder
- Local time
- Tomorrow, 07:55
- Joined
- Jan 5, 2009
- Messages
- 5,039
dportas may have chosen to leave this discussion. However, I would prefer to explain these differences of opinions that have been raised.
I would prefer not to get off the main point by discussing other points such as Surrogate V Natural, Trade offs etc.
I will refer to any who may be reading this to my original statement in Post # 10 where I said.
After some debate my opinion has not changed.
I have experienced first hand the result of many fields combined to create a Primary Key. If you have not seen this then may I suggest that you create a Database where all Tables have a Composite Primary Key of, say for example 4 Fields. Create a dozen or more tables. Finally go to the Relationship Window and create the joins. The complexity of it all is such that it is at least difficult to understand if not near on impossible.
Now do the same with a single field as the primary key. Much clearer and easy to follow.
I digress so back to the point.
I refer to my post # 21 where I said
For this example I will use UPPER CASE for CLIENTS and lower case for invoices.
A a
A b
A c
B a
B b
B c
C a
C b
C c
All of these are unique and can be enforced by creating a Unique Index so that A a etc cannot be repeated.
A Single Primary Key is also unique as per the rules of Access.
1
2
3
4
5
6
7
8
9
These are all unique.
Now to complete the picture create a table with a Primary Key of Autonumber and a Unique Index of CLIENT and invoice. We end up with the following.
1 A a
2 A b
3 A c
4 B a
5 B b
6 B c
7 C a
8 C b
9 C c
It is not possible that 7 could refer to anything other than "C a". 7 Cannot be duplicated and "C a" cannot be duplicated.
These facts cannot be disputed.
Therefore, there is no advantage in using Composite Primary Keys. If you choose to do so then that is your option. However, to attempt to prove that a Composite Primary Key has an advantage over a single Primary Key with a unique Index is futile and incorrect.
The advantage of a Single Field as Primary Key is simplicity and clarity.
I would prefer not to get off the main point by discussing other points such as Surrogate V Natural, Trade offs etc.
I will refer to any who may be reading this to my original statement in Post # 10 where I said.
Why would you use 2 or 3 or 4 or more fields to create a Primary Key when you can do it with just One.
After some debate my opinion has not changed.
I have experienced first hand the result of many fields combined to create a Primary Key. If you have not seen this then may I suggest that you create a Database where all Tables have a Composite Primary Key of, say for example 4 Fields. Create a dozen or more tables. Finally go to the Relationship Window and create the joins. The complexity of it all is such that it is at least difficult to understand if not near on impossible.
Now do the same with a single field as the primary key. Much clearer and easy to follow.
I digress so back to the point.
I refer to my post # 21 where I said
An AutoNumber is unique.
This was challenged so I shall explain.Client Number together with Invoice Number is unique (Using a unique Index) then it follows that the Primary Key can only refer to the unique Index.
For this example I will use UPPER CASE for CLIENTS and lower case for invoices.
A a
A b
A c
B a
B b
B c
C a
C b
C c
All of these are unique and can be enforced by creating a Unique Index so that A a etc cannot be repeated.
A Single Primary Key is also unique as per the rules of Access.
1
2
3
4
5
6
7
8
9
These are all unique.
Now to complete the picture create a table with a Primary Key of Autonumber and a Unique Index of CLIENT and invoice. We end up with the following.
1 A a
2 A b
3 A c
4 B a
5 B b
6 B c
7 C a
8 C b
9 C c
It is not possible that 7 could refer to anything other than "C a". 7 Cannot be duplicated and "C a" cannot be duplicated.
These facts cannot be disputed.
Therefore, there is no advantage in using Composite Primary Keys. If you choose to do so then that is your option. However, to attempt to prove that a Composite Primary Key has an advantage over a single Primary Key with a unique Index is futile and incorrect.
The advantage of a Single Field as Primary Key is simplicity and clarity.


