What is PRIMARY KEY in ms access? What is it used for?
Although a primary key maybe used as an index to assist in searching the database (The records are sorted by the primary key) its main purpose is to uniquely identify a given record within the database. Like a Social Security Number which uniquely identifies a person so does a PRIMARY key identify a unique record in the database. An other example of a unique number which could be used as a primary key would be a phone number A Primary key can be anything (letters, numbers, combination of data fields) so long as it only appears no more than one time in a particular Table within a database. So if I had a table with ten records in it I could make a primary key using aRecordID field consisting of sequential number from 1 to 10. And for each record added I would increment the RecordID field generating a new unique Primary Key. If I tried using names as a primary key it would be difficult to use a first name as a primary key as many people have the same name. A Compound Primary Key is when s