Documente Academic
Documente Profesional
Documente Cultură
7th Lec
Relational Keys
• Super key
• Candidate key
• Primary key
• Alternate key
• Foreign key
• Composite key
• Unique key
Key
• The keys are defined in the table to access or sequence the stored data
quickly and smoothly.
• Keys are used to create relationship between different tables.
Primary Key
• The primary key identifies every record in a table uniquely.
• Primary key is unique and can not be have Null Value.
• A super key may contain additional attributes that are not necessary
for unique identification.
• There are situations when a single column can not constitute a key.
This is because a single column cannot uniquely identify every row in
the table. Instead we need to have two or more columns together in
order to identify every row in the table uniquely.
{ Supplier-ID, Prod-ID, Quantity }
• Any candidate key, which is not the primary key is an alternate key.
• Alternate keys or secondary are keys that may or may not identify a
record uniquely, but help in faster searching.
Alternate Key
Foreign Key
• A foreign key is a set of columns in one table, which is a primary key
in another table.