Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Database Design / April 2008

Tip: Looking for answers? Try searching our database.

Question re composite key

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
C Tate - 02 Apr 2008 21:46 GMT
I have to design a database. It will contain details of planning
applications. I've been told there is not a single item which will identify a
site. There may be two reference numbers. I think this is a composite key.
Are there any important points I should know if I use a composite key? Will
it make my database more complicated to design/use?
Evan Keel - 02 Apr 2008 21:58 GMT
Composite keys are two or more columns that uniquely identify a row. They
can make your db harder to work with (joins for example) but add more
meaning than just a surrogate key. If you find that the number of columns
become unwieldy, then think surrogate key. For more info google "surrogate
key".

I'm not sure about two reference numbers used a composite key. Please post
the table structure you are considering..

Good luck!
Evan
> I have to design a database. It will contain details of planning
> applications. I've been told there is not a single item which will identify a
> site. There may be two reference numbers. I think this is a composite key.
> Are there any important points I should know if I use a composite key? Will
> it make my database more complicated to design/use?
John W. Vinson - 02 Apr 2008 22:29 GMT
>I have to design a database. It will contain details of planning
>applications. I've been told there is not a single item which will identify a
>site. There may be two reference numbers. I think this is a composite key.
>Are there any important points I should know if I use a composite key? Will
>it make my database more complicated to design/use?

Access allows up to ten fields in a composite key, and you *can* use composite
primary keys linked to composite foreign keys. The queries can get pretty
snarky though! If you don't have any child tables related one to many to this
table, by all means use the composite key. If you do have child tables,
consider making a unique Index on the combination, and adding a "surrogate"
autonumber primary key, using it as the link to a Long Integer foreign key in
the child tables.
Signature


            John W. Vinson [MVP]

Evi - 03 Apr 2008 01:06 GMT
An Autonumber is a nice safe option and easy to use for lazy types like me.
You can still have your numbers but if someone decides that they don't want
to use one of them or they aren't as unique as you were led to believe, you
won't find yourself with an enormous problem. The two numbers can
concatenated in a query to make a unique number for combo boxes in forms
Evi

> I have to design a database. It will contain details of planning
> applications. I've been told there is not a single item which will identify a
> site. There may be two reference numbers. I think this is a composite key.
> Are there any important points I should know if I use a composite key? Will
> it make my database more complicated to design/use?
binny - 03 Apr 2008 05:55 GMT
If you substitute "name" for "number" we all have two reference codes
ie:first name.  Last name.
Think of your 2 reference numbers like that, label them in your table,
first number,last number
But use an auto generated primary key to uniquely identify every record in
your table.  In the same way you would in a contacts organiser.
The only purpose of the primary key is as a unique reference for the
database search engine.  No one shows it on forms or in reports.
binny

> I have to design a database. It will contain details of planning
> applications. I've been told there is not a single item which will identify a
> site. There may be two reference numbers. I think this is a composite key.
> Are there any important points I should know if I use a composite key? Will
> it make my database more complicated to design/use?
david@epsomdotcomdotau - 05 Apr 2008 17:46 GMT
You must have your key fields indexed in the same order in
both indexes, ie (ref_1, ref_2) = (ref_1, ref_2) not
(ref_2, ref_1), (ref_1,ref_2).

You were probably going to do that anyway ... but there is
no obvious indication if you get it wrong, it just doesn't work.

(david)

> I have to design a database. It will contain details of planning
> applications. I've been told there is not a single item which will identify a
> site. There may be two reference numbers. I think this is a composite key.
> Are there any important points I should know if I use a composite key? Will
> it make my database more complicated to design/use?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.