We help IT Professionals succeed at work.

Microsoft Acess 2007: Primary Key

tjie
tjie used Ask the Experts™
on
Hi,

1) I am studying the Microsoft Access 2007
2) There are some objects of Microsoft Access, such as Table, Form, Query, etc
3) I saw a term called "Primary key" at a Table
4) My questions:
First: What is "Primary Key"? (Pls explain with your own wording and understanding; i do not need the links)
Second: This Primary key is ONLY for a Table? (or other OBJECTS such as Form, Query, Report, etc ........ALSO have a Primary key?)
Third: Other things related to Primary keys? please explain
5) Thank you

tjie
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
This explains it better than I could!
 The primary key of a relational table uniquely identifies each record in the table. It can either be a normal attribute that is guaranteed to be unique (such as Social Security Number in a table with no more than one record per person) or it can be generated by the DBMS (such as a globally unique identifier, or GUID, in Microsoft SQL Server). Primary keys may consist of a single attribute or multiple attributes in combination.
http://databases.about.com/cs/administration/g/primarykey.htm


Only Tables have primary keys, not other objects.

More Info

http://en.wikipedia.org/wiki/Unique_key

Gary
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
Top Expert 2007
Commented:
A Primary Key is a field in a Table  (tables only) that is guaranteed to be Unique and cannot repeat. A table can have only one Primary Key; however, the Primary Key can be 'compound', ie made of up two or more fields, the combination of which are guaranteed to be unique. But, there is rarely just justification for this in an Access database, since the Access Auto Number pretty makes the perfect Primary Key for any table.

When a table has a Primary, this table can then be used in a Relationship with one or more other tables. W/O a Primary Key, Referential Integrity cannot be enabled.

Primary Keys only apply to Tables.

mx
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
Top Expert 2007

Commented:
Note ... what I explained was in my own words :-)

mx
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
Top Expert 2007
Commented:
"attribute that is guaranteed to be unique (such as Social Security Number i"

Sadly in the real world, Social Security numbers cannot be guaranteed to be unique.  And due to the limited security, SS numbers should *never* be stored (fully) in an Access database.

mx
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
Top Expert 2007

Commented:
So tjie ... You stated "Pls explain with your own wording and understanding; i do not need the links"
What happened ?

mx

Author

Commented:
Hey mx,
1) Yes, it is correct
2) I read Gary's personal wording (not the link) and he is explaining earlier ...
3) Thank you for both of you

tjie
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
Top Expert 2007

Commented:
Gary's wording is a *direct* copy from the first paragraph of the article, sorry.

mx

Author

Commented:
mx,

1) Sorry, i  do not check it
2) I owe you one
3) Thanks for the correction

tjie

Commented:
The definition given isn't quite sufficient because a primary key is actually supposed to be a candidate key and a candidate key is not only required to uniquely identify a tuple (row) it must also be irreducibly unique - ie, if you remove any attribute from the key it will no longer be unique.
A set of attributes that is unique (ie. "uniquely identifies a row") is called a superkey.
A candidate key is a minimal superkey.
A primary key is a candidate key.
The minimality requirement is therefore a distinguishing factor of a primary key, not only its uniqueness. This is important because dependency theory and the normalization process attache signifcance to identifying candidate keys and the dependencies on them.