Working with databases/Create a database/Primary keys
From WikiEducator
Working with databases | |
---|---|
Create a database | Introduction | Table design | Data types | Field properties | Primary keys | Adding information | Records and tables | Key points | Assessment |
What is a Primary key?
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.
|
Here is a table of gym members from a membership database:
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.