473,396 Members | 2,014 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Picking the Primary Key

Hi all,

Iam a first time user of any database. I am using A2003. I want to design a
database for county marriage records. So far, I have the following tables:

COUNTY: County GROOM: SurnameGr BRIDE: SurnameBr
MARRIAGEDATA: LicenseIssuedDate
Book GivenNameGr
GivenNameBr MarriageDate
Page AgeGr
AgeBr
MarriagePerformedBy

My question is should I allow Access to use the Autonumber or can I use a
multifield key. I would like to use the three fields in the COUNTY table as
the key since all the other info comes from them. There are no common fields
in the other tables. How can I connect the 4 tables? tia

Dwight
Jul 15 '06 #1
5 1473
County table: one record for each county, with a CountyID primary key

Person table: one record for each person, with a PersonID primary key

Marriage table: one record for each marriage. Fields:
MarriageID primary key
CountyID where the marriage was registered.
BookID the book where this entry is found.
Page the page number/registry number.
RegistryID if the county has a unique registry number to enter.
GroomID relates to the PersonID field in Person table.
BrideID relates to the PersonID field in Person table.
LicenseIssuedDate When the marraiage was registered.

Since the Marriage involves 2 persons, you will need to add a 2nd copy of
the Person table to the Relations window (Tools | Relationhips). Access will
alias this as Person_1. You can now create the 2 relations from:
Person.PersonID to Marriage.GroomID
Person_1.PersonID to Marriage.BrideID

Now to answer your question, you can use a combination of natural keys (such
as State + County) for simple tables. But for the people, the natural keys
are probably too obsucre. You could use a combination of the person's name,
birthplace, and date of birth, but you are then stymied for someone who has
any one of these items unknown.

Rather than storing the age of the person at marriage, it would be better to
store the BirthDate in the Person table.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Dwight" <ed*******@comcast.netwrote in message
news:sa******************************@comcast.com. ..
>
Iam a first time user of any database. I am using A2003. I want to design
a database for county marriage records. So far, I have the following
tables:

COUNTY: County GROOM: SurnameGr BRIDE: SurnameBr
MARRIAGEDATA: LicenseIssuedDate
Book GivenNameGr GivenNameBr
MarriageDate
Page AgeGr AgeBr
MarriagePerformedBy

My question is should I allow Access to use the Autonumber or can I use a
multifield key. I would like to use the three fields in the COUNTY table
as the key since all the other info comes from them. There are no common
fields in the other tables. How can I connect the 4 tables? tia

Dwight

Jul 15 '06 #2
comteck
179 100+
Your main objective with any database is to use as little space as possible, which is why an ID of some sort is best used as a PK (autonumber works best for the main table). For example, in your case, let's call the PK of the main table RECORDID (data type is autonumber).

To link to another table add 2 ID fields, one being RECORDID and another ID (say MARRIAGEID), and make both those IDs the PKs for the second table (the data type for these would be "Number" not "Auronumber"). Then you would create a one to many relationship between the 2 tables (the main table would be one, and the second table would be many).

If you were to create a subform on your main form (the subform's Record Source being the second table, and the main form's Record Source being the main table), Access would automatically create a link between the 2 forms due to the relationship that was created.

This is the standard way of creating links between 2 or more tables in access.

Hope this helps.
comteck
Jul 15 '06 #3
In this case, however, he probably doesn't have birthdates for the people,
just the age info from the marriage license, so it makes sense to store it.
After all, "age at marriage" won't need to be changed as the years go by,
anyway.

Anne (who also does genealogy)

"Allen Browne" <Al*********@SeeSig.Invalidwrote in message
news:44***********************@per-qv1-newsreader-01.iinet.net.au...
County table: one record for each county, with a CountyID primary key

Person table: one record for each person, with a PersonID primary key

Marriage table: one record for each marriage. Fields:
MarriageID primary key
CountyID where the marriage was registered.
BookID the book where this entry is found.
Page the page number/registry number.
RegistryID if the county has a unique registry number to enter.
GroomID relates to the PersonID field in Person table.
BrideID relates to the PersonID field in Person table.
LicenseIssuedDate When the marraiage was registered.

Since the Marriage involves 2 persons, you will need to add a 2nd copy of
the Person table to the Relations window (Tools | Relationhips). Access
will alias this as Person_1. You can now create the 2 relations from:
Person.PersonID to Marriage.GroomID
Person_1.PersonID to Marriage.BrideID

Now to answer your question, you can use a combination of natural keys
(such as State + County) for simple tables. But for the people, the
natural keys are probably too obsucre. You could use a combination of the
person's name, birthplace, and date of birth, but you are then stymied for
someone who has any one of these items unknown.

Rather than storing the age of the person at marriage, it would be better
to store the BirthDate in the Person table.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Dwight" <ed*******@comcast.netwrote in message
news:sa******************************@comcast.com. ..
>>
Iam a first time user of any database. I am using A2003. I want to design
a database for county marriage records. So far, I have the following
tables:

COUNTY: County GROOM: SurnameGr BRIDE: SurnameBr
MARRIAGEDATA: LicenseIssuedDate
Book GivenNameGr GivenNameBr
MarriageDate
Page AgeGr AgeBr
MarriagePerformedBy

My question is should I allow Access to use the Autonumber or can I use a
multifield key. I would like to use the three fields in the COUNTY table
as the key since all the other info comes from them. There are no common
fields in the other tables. How can I connect the 4 tables? tia

Dwight


Jul 15 '06 #4
You may be right, Anne.

It seems to me that the person's age is an attribute of the person, not an
attribute of the marriage. Storing age-at-marriage + date-of-marriage
contains redundant data, and therefore introduces the possibility of
inconconsistency (e.g. someone was recorded as 20 when they married in 1900,
and 22 when they married again in 1910.)

But, as you point out, the OP may only have the data that way, and may
*want* to record the fact that the data is inconsistent.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Anne Nolan" <an***************@AOL.COMwrote in message
news:4h************@individual.net...
In this case, however, he probably doesn't have birthdates for the people,
just the age info from the marriage license, so it makes sense to store
it. After all, "age at marriage" won't need to be changed as the years go
by, anyway.

Anne (who also does genealogy)

"Allen Browne" <Al*********@SeeSig.Invalidwrote in message
news:44***********************@per-qv1-newsreader-01.iinet.net.au...
>County table: one record for each county, with a CountyID primary key

Person table: one record for each person, with a PersonID primary key

Marriage table: one record for each marriage. Fields:
MarriageID primary key
CountyID where the marriage was registered.
BookID the book where this entry is found.
Page the page number/registry number.
RegistryID if the county has a unique registry number to enter.
GroomID relates to the PersonID field in Person table.
BrideID relates to the PersonID field in Person table.
LicenseIssuedDate When the marraiage was registered.

Since the Marriage involves 2 persons, you will need to add a 2nd copy of
the Person table to the Relations window (Tools | Relationhips). Access
will alias this as Person_1. You can now create the 2 relations from:
Person.PersonID to Marriage.GroomID
Person_1.PersonID to Marriage.BrideID

Now to answer your question, you can use a combination of natural keys
(such as State + County) for simple tables. But for the people, the
natural keys are probably too obsucre. You could use a combination of the
person's name, birthplace, and date of birth, but you are then stymied
for someone who has any one of these items unknown.

Rather than storing the age of the person at marriage, it would be better
to store the BirthDate in the Person table.

--
"Dwight" <ed*******@comcast.netwrote in message
news:sa******************************@comcast.com ...
>>>
Iam a first time user of any database. I am using A2003. I want to
design a database for county marriage records. So far, I have the
following tables:

COUNTY: County GROOM: SurnameGr BRIDE: SurnameBr
MARRIAGEDATA: LicenseIssuedDate
Book GivenNameGr GivenNameBr
MarriageDate
Page AgeGr AgeBr
MarriagePerformedBy

My question is should I allow Access to use the Autonumber or can I use
a multifield key. I would like to use the three fields in the COUNTY
table as the key since all the other info comes from them. There are no
common fields in the other tables. How can I connect the 4 tables? tia

Dwight

Jul 16 '06 #5
If you want to see inconsistencies in ages, try recording ages as reported
in census data over the years. I've seen people age only 6 years during the
10 years between censuses. LOL!

You learn to take that info with a large grain of salt. :)

About the only way to have a reliable birthdate is to have a birth
certificate.

Cheers,

Anne

"Allen Browne" <Al*********@SeeSig.Invalidwrote in message
news:44***********************@per-qv1-newsreader-01.iinet.net.au...
You may be right, Anne.

It seems to me that the person's age is an attribute of the person, not an
attribute of the marriage. Storing age-at-marriage + date-of-marriage
contains redundant data, and therefore introduces the possibility of
inconconsistency (e.g. someone was recorded as 20 when they married in
1900, and 22 when they married again in 1910.)

But, as you point out, the OP may only have the data that way, and may
*want* to record the fact that the data is inconsistent.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Anne Nolan" <an***************@AOL.COMwrote in message
news:4h************@individual.net...
>In this case, however, he probably doesn't have birthdates for the
people, just the age info from the marriage license, so it makes sense to
store it. After all, "age at marriage" won't need to be changed as the
years go by, anyway.

Anne (who also does genealogy)

"Allen Browne" <Al*********@SeeSig.Invalidwrote in message
news:44***********************@per-qv1-newsreader-01.iinet.net.au...
>>County table: one record for each county, with a CountyID primary key

Person table: one record for each person, with a PersonID primary key

Marriage table: one record for each marriage. Fields:
MarriageID primary key
CountyID where the marriage was registered.
BookID the book where this entry is found.
Page the page number/registry number.
RegistryID if the county has a unique registry number to enter.
GroomID relates to the PersonID field in Person table.
BrideID relates to the PersonID field in Person table.
LicenseIssuedDate When the marraiage was registered.

Since the Marriage involves 2 persons, you will need to add a 2nd copy
of the Person table to the Relations window (Tools | Relationhips).
Access will alias this as Person_1. You can now create the 2 relations
from:
Person.PersonID to Marriage.GroomID
Person_1.PersonID to Marriage.BrideID

Now to answer your question, you can use a combination of natural keys
(such as State + County) for simple tables. But for the people, the
natural keys are probably too obsucre. You could use a combination of
the person's name, birthplace, and date of birth, but you are then
stymied for someone who has any one of these items unknown.

Rather than storing the age of the person at marriage, it would be
better to store the BirthDate in the Person table.

--
"Dwight" <ed*******@comcast.netwrote in message
news:sa******************************@comcast.co m...

Iam a first time user of any database. I am using A2003. I want to
design a database for county marriage records. So far, I have the
following tables:

COUNTY: County GROOM: SurnameGr BRIDE: SurnameBr
MARRIAGEDATA: LicenseIssuedDate
Book GivenNameGr GivenNameBr
MarriageDate
Page AgeGr AgeBr
MarriagePerformedBy

My question is should I allow Access to use the Autonumber or can I use
a multifield key. I would like to use the three fields in the COUNTY
table as the key since all the other info comes from them. There are no
common fields in the other tables. How can I connect the 4 tables? tia

Dwight


Jul 16 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: John Simmons | last post by:
How is it that even though I have the column "username" in my database set as a Primary key, using my PHP script to add new users to the database works without any errors even when signing up using...
5
by: Ghulam Farid | last post by:
Hi i have a table with primary key defined on col1 and col2. now i want to have col3 also included in primary key. when i alter the table it gives me error for duplicate rows. there is an option...
4
by: Mavis Tilden | last post by:
Hi all, So I've been reading the newsgroups, and reading a few books trying to learn SQL and SQL Server 2000. The books tell me I need a Primary Key, and that every table should have one. I know...
9
by: 101 | last post by:
Taking a course on SQL. They are saying you can get better performance by having multiple files for a group. They then graphically show an example of "Primary" with multiple data files. I have...
4
by: serge | last post by:
I ran into a table that is used a lot. Well less than 100,000 records. Maybe not a lot of records but i believe this table is used often. The table has 26 fields, 9 indexes but no Primary Key at...
5
by: shenanwei | last post by:
I have a primary server and backup server located in different physical sites. The primary server is live and ship logs to backup site every 5 minutes. The primary server is being full online...
18
by: Thomas A. Anderson | last post by:
I am a bit confused in creating a composite primary key. I have three table with two of the tables containing primary keys. I have two of the tables (each with a primary key) having one to many...
8
by: Challenge | last post by:
Hi, I got error, SQL1768N Unable to start HADR. Reason code = "7", when I tried to start hadr primary database. Here are the hadr configuration of my primary db: HADR database role ...
4
by: Peter | last post by:
I am interested in informed feedback on the use of Constraints, Primary Keys and Unique. The following SQL statement creates a Bands tables for a database of bookings Bands into Venues, where the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.