Database Related

What Is The Definition Of A Secondary Key?

In SQL, the term secondary key is often misunderstood. In order to get a clear idea about the concept of secondary key, it is essential to know about the other kinds of keys in the database language. There are basically three kinds of keys in SQL:

  • Primary Key
  • Foreign Key
  • Secondary Key

Although there is a lot of confusion seen in defining secondary key by a lot of people, the concept is surprisingly simple. Database management systems (DBMS) use sets of rows and columns for specifying the information about certain groups of people. These rows and columns are arranged together in the form of tables. These tables consist of a number of parameters or attributes. These attributes specifying certain information about people are known as keys. Now, for the sake of convenience, one of the attributes or keys is assigned as top priority key. This key will be used as the first attribute to distinguish an individual. One example of this is the Personal ID of a person. This top priority key will be termed as the ‘Primary Key’.


Secondary key is NOT foreign key:

A vast population of people is never sure how to differentiate between the secondary key and the foreign key. A foreign key is simply a primary key from a given table which appears as an attribute in another as well, such that the two tables are inter-related. For example, in the table shown above (name it table A), Personal ID is the primary key. Now if another related table, say table B, is present where personal ID is listed as an attribute, then Personal ID would be a foreign key in table B with respect to table A.

In the end, we can simply define Secondary Key in terms of database management systems as follows:

The keys or fields in a table which have not been selected to be the primary key, but are considered to be the candidate keys for the primary key are referred to as Secondary Keys.”

Leave a Reply