What are super, primary, candidate and foreign keys?

Super, primary, candidate and foreign are different types of keys. A key is a single or combination of multiple fields, with the purpose to allow access or retrieval of data rows from a table as required. The keys differ in the manner they access or sequence the stored data. The keys can also be them used to create links between different tables.

A primary key is an attribute or combination of attributes that uniquely identifies a row or record in a relation. A relation can have only one primary key.

A candidate key or alternate key is any attribute within the table that is not being utilized as the primary key.

A foreign key is an attribute or a combination of attributes in a relation whose value match a primary key in another relation. The foreign key is created in a dependent table. The table to which the foreign key refers to is known as the parent table.

A Super key is a combination of attributes that can be used to uniquely identify a database record. A table may have many superkeys.  

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.