Relationship Keys
 

Keys are used to identify records in a table uniquely.

Candidate key
is a single field or the least combination of fields that uniquely identifies each record in the table.  


Primary Key
in the STUDENTS table, for each student there will be one row in the table.
In order to identify each entity (student) uniquely in the table, we use studentNO
column is the primary key.

There can be only one primary key in a table


Composite Primary Key
In some tables a single column cannot be used to uniquely identify entities (rows). In that case, we have to use two or more columns to uniquely identify rows of the table.



In the above case studentNo + DP columns together can be used to identify the records uniquely.

Foreign Key

In RDBMS we store data in different tables and join them to get complete information.
In the PAYMENTS table we have studentNo which can link STUDETNS table to get student name The studentNo is the primary key of the STUDENTS table and Foreign Key of the PAYMENTS table.


Alternate key
A a key associated with one or more columns whose values uniquely identify every row in the table, but it is not the primary key.

For example, where the primary key for a table may be the employee id, the alternate key might combine the first, middle, and last names of the employee

Identify Candidate Keys, Primary Keys, Foriegn Keys , Composite Keys in Following Relationship Model



Can you 
1. Describe Entities
2. Describe Relationships 
3. Describe Cardinalities
4. Describe Degree
5. Describe Primary Keys
c. Describe Foreign Keys

(c) Shilpa Sayura Foundation 2006-2017