Difference between Primary key, Foreign key, super key and Candidate key.
For example: Employee id is the primary key in the Employee table. Primary key is identify by the underline(_) symbol.
Super Key: It is define as a set of attributes which identify every tuple uniquely. Example of super key from employee table is follow:
Super Key : {emp_id}, {emp_id, emp_name}.
Candidate Key : It is define as set of minimum number of attributes which identifies every tuple uniquely. Example of Candidate key from employee table is follow:
Candidate Key : {emp_id}.
Minimality Property : A super key with minimum number of attributes is known as Candidate key and minimality property is, from a set which is identify tuple uniquely. If we remove any attribute then uniqueness property should be lost.
Every Candidate Key = Super Key
Every Super Key != Candidate Key
Foreign Key : It is define as a share key from a table which is acting as a strong entity. Such a key is used by a week entities to establish relationship with the strong entities on which week entities are dependent, such key are the primary key into the strong entities.
Lets understand with the help of tables.
Comments
Post a Comment