A key is an attribute (also known as column or field) or a combination of attribute that is used to identify records.
There is different type of keys available in database management system:
1) Primary Key: The primary key of a relational table uniquely identifies each record in the table. A Primary Key can consist of one or more attributes of a table.
2) Foreign Key: A foreign key is an attribute or combination of attribute in one base table that points to the candidate key (generally it is the primary key) of another table. The purpose of the foreign key is to ensure referential integrity of the data i.e. only values that are supposed to appear in the database are permitted.
3) Candidate Key: A candidate key is a field or combination of fields that can act as a primary key field for that table to uniquely identify each record in that table. Each table may have one or more candidate keys.
4) Composite Key: If we use multiple attributes to create a Primary Key then that Primary Key is called Composite Key (also called a Compound Key or Concatenated Key).
5) Alternate Key: Alternate Key can be any of the Candidate Keys except for the Primary Key.
6) Secondary Key: An attribute or set of attributes that is basis for retrieval is known as secondary key.
For example, address in student table can be used to display all students who are living in a particular city. In this case, address will be used as secondary key.
7) Super Key: An attribute or a combination of attribute that is used to identify the records uniquely is known as Super Key.
There is different type of keys available in database management system:
- Primary Key
- Foreign Key
- Candidate Key
- Composite Key
- Alternate Key
- Secondary Key
- Super Key
1) Primary Key: The primary key of a relational table uniquely identifies each record in the table. A Primary Key can consist of one or more attributes of a table.
2) Foreign Key: A foreign key is an attribute or combination of attribute in one base table that points to the candidate key (generally it is the primary key) of another table. The purpose of the foreign key is to ensure referential integrity of the data i.e. only values that are supposed to appear in the database are permitted.
3) Candidate Key: A candidate key is a field or combination of fields that can act as a primary key field for that table to uniquely identify each record in that table. Each table may have one or more candidate keys.
4) Composite Key: If we use multiple attributes to create a Primary Key then that Primary Key is called Composite Key (also called a Compound Key or Concatenated Key).
5) Alternate Key: Alternate Key can be any of the Candidate Keys except for the Primary Key.
6) Secondary Key: An attribute or set of attributes that is basis for retrieval is known as secondary key.
For example, address in student table can be used to display all students who are living in a particular city. In this case, address will be used as secondary key.
7) Super Key: An attribute or a combination of attribute that is used to identify the records uniquely is known as Super Key.
0 comments:
Post a Comment