SUPER KEY
- A set of one or more attribute taken collectively which can identify a record uniquely from a relation.
- Example: {roll_no} is a super key in student relation.
- Let AK be a set of attributes of a relations R and let t1 and t2 be the two tuples in r of R, then AK will be the super key of relation R if t1{AK} is not equal to t2{AK}
- A B C a1 b1 c1 a2 b2 c2 a3 b3 c3 Here {AB}, {BC}, {AC}, {ABC} are super keys of R.
- The set of all attributes of a relation is a default super key of relation
- The super key contains extraneous attributes
PRIMARY KEY
- It is a specific key which consist of most independent attributes.
- When an attribute is defined to be a primary key, then every incoming value is tested to be non-null and unique.
- Example: Roll_no is primary key to student relation
FOREIGN KEY
- In a relation, the column whose values corresponds to the values of key column in other relation is called Foreign key.
- Example: Product= Pro_code Name | Supp_code (Pro_code ->Product_Code, Supp_code -> Supplier_Code, So here Pro_code is primary key)
Supplier=Supp_code | Supp_name (Supp_code -> Supplier_Code, Supp_name -> Supplier name,
So here Supp_code is Foreign Key)
(Note all these definitions or statements were taken from different sources from web )
:)
EmoticonEmoticon