Mail us
Home » MS Access » What is the function of primary key when creating a database in access ?

What is the function of primary key when creating a database in access ?

What is the function of primary key when creating a database in access ?

create_a_database MS access

When building an access database, the primary key is important and an important thing to note when creating a database in access. Before continuing you should know what primary keys mean.

What is a primary key

Primary keys are fields or fields with values that are unique throughout a table when building an access database. Primary keys can be used to refer to entire records, each record has a different value for the key. A table can only contain just one primary key. Ms Access will either automatically create a primary key field for you when you create a table, or you can specify you want to use as the primary key.

Function of the primary key

The major function of a primary key when creating database in access is to implement relationship between tables in a relational database, you can not declare a foreign key in a table Q to relate with table R unless you have defined the primary key in table Q. Primary key allows you to create a unique identifier for each row in your table. It is important because it helps you link your table to other tables (relationships) using primary key as links.

Primary keys also provide a means to specifically and uniquely identify a row of data (or record) in a table when building access database. For example, in an employee table, the primary key would be the employee number, unique to each employee.

Setting the primary key

When adding primary keys to your database here are the steps to follow in building access database, note that for a primary key to function, the field must uniquely identify each row.,

  • Open the database that you want to modify.
  • Right-click the table in which you want to set the primary key from the navigation pane and, on the shortcut menu, click Design View. You can also press F11 to display
  • Select the field that you want to use as your primary key.
  • On the Design tab, in the Tools group, click Primary Key A key indicator is added to the left of the field or fields that you specify as the primary key.

Removing a primary key

When removing the primary key, the field that formerly served as primary key will no longer provide the primary means of identifying a record. Note that removing the primary key would not delete the fields from your table, but will remove the index that was created for the primary key when building access database.

You  can visit our YouTube channel  and learn more about Microsoft Access Database.

Tags: , , , , , ,

One Response so far.

  1. MindStick says:

    Microsoft Access table has a field or set of fields that uniquely identify each record stored in the table, it can be set as the primary key.