How to Determine Which Primary Key Type to Use in Microsoft Access

Save
Next Video:
How to Update Data in a Microsoft Access Query....5

When determining which primary key type to use in Microsoft Access, it's important to understand that primary keys are sets of fields that uniquely identify a particular record that is stored in a given table. Find out the differences between single fields and multiple fields in primary keys with help from a computer programming teacher in this free video on Microsoft Access.

Part of the Video Series: Microsoft Access Tutorial
Promoted By Zergnet

Comments

Video Transcript

Hello, my name is Chip Browne, and I teach Computer Programming, and Microsoft Office applications, at a local business college, Stevens Henager, here in Utah, and I also create practice tests for Microsoft Office Application Certifications. Today, we're going to learn how to determine, which primary key type to use, in Microsoft Office Access 2007. Microsoft Access is a registered trademark of Microsoft Corporation. I'm not affiliated with Microsoft Corporation. In order to make a decision on what type of primary key you'll use, you need to understand what primary keys are. Every table in your database should have a primary key. A primary key is a field, or a set of fields, that uniquely identify a particular record, stored in that table. There are two types of primary keys, either a single field, or a multiple field. Let's look at our relationships, and you can see examples. Click on Database Tools, and then click on Relationships, in the Show Hide group, and here is a diagram, of all the tables in our database. Every table here has a primary key. It's represented by that field, which has the key icon next to it. Like I said, you have primary keys, that are single field, and primary keys that are multiple fields. Over here, in the Employee Privileges Table, there is a multiple key field, where there are more than one field required, to uniquely identify a record in that table. In the Zip Codes Table here, we don't have an ID field, that is single numbers, 1, 2, 3, 4, 5. We actually use a field called Zip Code, which is unique, for each of the records, that are in this table. You can use that, if you have that in your data of your table, you can use that field as your primary key. If not, you can rely upon Access to create a field, and automatically put numbers in that field, to have a unique number. Let's see how that Access does that. Let's close this out. Click on Close, and now we'll go into the Create tab, and then Create a Table. Click on Table, in the tables group, and immediately, this default table, already has this first field in it, the ID field. If we go into a Design View, click on View, and then Design View. Name the table, and save it. You can see right here that, that first field, has a Name ID, and a Data Type of AutoNumber, and this is Access giving you the opportunity to automatically create a unique field, with an AutoNumber Data Type. Use an Auto Number primary key, when you don't have another field, that uniquely identifies a record, so, once again in summary, there are two types of primary keys. One, where a particular single field, will uniquely identify a record in a table, and the other, a multiple field, where it will require more than one field, to uniquely identify a record in a table. You make the decision based upon your data. For more information, and videos, visit me, Chip Browne, at chipbrowne.com, that's Browne, with an E.

Featured

Related Searches

M
Is DIY in your DNA? Become part of our maker community.
Submit Your Work!