Oops! It appears that you have disabled your Javascript. In order for you to see this page as it is meant to appear, we ask that you please re-enable your Javascript!

Super, Alternate, Candidate, Primary, Composite, Foreign Key in DBMS

Last modified on January 3rd, 2019 at 2:31 pm

Super, Alternate, Candidate, Primary, Composite, Foreign Key in DBMS

Today, in this fresh new article, we will cover the following topics;

  1. Key
  2. Super Key
  3. Alternate Key
  4. Candidate Key
  5. Primary Key
  6. Composite Key
  7. Foreign Key

What is the key?

A key is a field that uniquely identifies a tuple in the relation. Key is used to sort the data.

What is the super key?

Super key is used to identify an attribute or set of attributes uniquely within the relation. Super key is a generalize superset of candidate keys.

What is a candidate key?

Candidate keys are the set of all those attributes that can be selected as a primary key.

What is the primary key?

The primary key is the most suitable key to select a primary key.

What is the alternate key?

All those attributes that can be selected as the primary key but not selected as primary key are called alternate keys.

What is the composite key?

A composite key is a set of two or more attributes that are together selected as a composite key.

Example of composite key:

RegistrationNoRollNoNameMarks
1-A11John44
1-A22Marry77

Table: Exams

In this example, RegistrationNo and RollNo are candidate keys. If we select RegistratinNo as the primary key then RollNo is alternate key.

If the primary key is on both RegistrationNo and RollNo then it represents a composite key.

What is the foreign key?

A foreign key is the primary key of one table that is linked with the field of another table.

foreign key to join two tables
Figure: Foreign key

In the figure, two tables are connected with each other through the foreign key.

CustomerID in left table is foreign key for CustomerID in right table

Test Your Understandings

1.Key not selected as primary key is called ………..?

Answer - Click Here:
alternate key

2.Keys that can be selected as primary key are called ………..?

Answer - Click Here:
candidate keys

3. ………..key is used to link the two tables?

Answer - Click Here:
Foreign key

Topic Covered

Super, Alternate, Candidate, Primary, Composite, Foreign Key in DBMS.

Prof. Fazal Rehman Shamil
Researcher, Publisher of International Journal Of Software Technology & Science ISSN: 2616-5325
Instructor, SEO Expert, Web Programmer and poet.
Feel free to contact.