English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

please explain with an example.

2007-09-17 06:03:54 · 5 answers · asked by footballfan 1 in Computers & Internet Programming & Design

5 answers

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 several fields in a record when combined create a unique ID within the database.

For example:
First Name
Last name
City
Date of birth

Each of the above taken individually may appear more than once. Many peopel may share a common first name or birthday. But combine these and the chances that more than one person shares the exact information for all of these fields is very remote.

So a compound primary key is used when using a unique ID like a SSN or phone number is impractical, or when you cannot validate that someone enters a true SSN or phone number. Imagine truing to entery your infor into a database using your SSN only to find that some elese entered your SSN for their data.

2007-09-17 08:38:35 · answer #1 · answered by MarkG 7 · 2 0

Access Primary Key

2016-12-17 08:27:04 · answer #2 · answered by ? 4 · 0 0

Primary Key Access

2016-10-07 06:57:00 · answer #3 · answered by ? 4 · 0 0

Suppose u r making a database of students in ur college
u may encounter cases where
2 students may have the same name or same Date of Birth

so in processing this datbase if u want to select students with names as "Andrew" u may get multiple records.

So it identify to records from each other we use Primary Keys.
Primary keys are fields whose values cannot be null or duplicates
Example : Social Security No or Student Roll Nos

2007-09-17 08:45:00 · answer #4 · answered by Andy 3 · 1 0

It is the field that must be unique and will be used as an index when searching for things... for instance, if you had a database of tax payers, the Social secuity number would probably be used as the primary key.

2007-09-17 06:11:24 · answer #5 · answered by Louis G 6 · 0 0

This Site Might Help You.

RE:
what is PRIMARY KEY in ms access? What is it used for?
please explain with an example.

2015-08-05 22:01:32 · answer #6 · answered by Anonymous · 0 0

For the best answers, search on this site https://shorturl.im/axksm

A "Primary Key" is not automatically an "AUTONUMBER". For the TABLE to incrementally add to the "Primary Key" it MUST be an "AUTONUMBER". Otherwise it uses the "DEFAULT VALUE" or whatever Logic You have built into the Default value/Query/Form that adds (APPENDS) records to the Table. If it IS an "AUTONUMBER" & is trying to repeat a value, then Try "REPAIRING" the DB. TOOLS>>Database Utilities>>Compact & Repair If not then You'll have to "troubleshoot" the Logic it is using to get to the "NEXT NUMBER"...

2016-04-09 21:05:56 · answer #7 · answered by Anonymous · 0 0

fedest.com, questions and answers