Working with databases/Create a database/Primary keys

From WikiEducator
Jump to: navigation, search
OtagoPoly Logo S.png




What is a Primary key?

Access-primarykey1.png

You may come across this term or have seen the small key icon next to a field name in your table. The simplest non-technical answer, is that a primary key identifies a field that will contain a unique value. No other record (or row) in our table will have the same value in that field.



Web-icon.png

Extra resources

  • See also page 12 of Database Management using OpenOffice Base

    If you haven't already downloaded this resource, you can do so here: Database Management using OpenOffice Base )




Here is a table of gym members from a membership database:

Access-primarykey2.png

We can see that the Member number is unique for each person, so this would be the best field to choose for the primary key.

The Surname field would not be as there are several people that share the same surname.