Primary keys are fundamental in database design.
They have been avoided up until know as they may cause problems for begining designers of databases if they are not first familiar with the other topics covered so far.
A primary key is a field that has a unique field (eg. StudentNumber-no two students have the same student number)
Common examples of primary keys in a business database would include a customer number (no two customers would have the same number assigned to them).
Another common use of primary keys is in transactions.
- For example in a store each time a customer brings up merchandise and pays for it a seperate transaction number would be assigned to that visit (transaction number)
- The same is true in a dentist office, each visit by a client would be assigned an appointment number.
When you create a table you can specify if a field is a primary key or not, if you do a table can not have more than one of these in it.
- Example: if you make the Student Number a primary key in the tblTimetable you would not be able to assign more than one course per student--this is a problem so it would not be designated a primary key in this table.
- However, in the case of tblStudents designating the Student Number as a primary key would be useful in preventing someone from accidentally assigning the same student number to two or more students--this could cause all sorts of problems if two students were given the same student number
