Difference between primary key and unique key and foreign key
Answers
Answered by
3
Hey mate here is your answer:
________________________
Primary key is a field or set of fields that uniquely identifies each record in a table , it doesn't contains any duplicate data.
When creating a query in Microsoft Access , you might want to return only distinct or unique values , in such cases unique key is used.
Foreign key is defined in second table , but it refers to the primary key or unique key in first table.
___________________________
HOPE IT HELPS YOU MATE!
________________________
Primary key is a field or set of fields that uniquely identifies each record in a table , it doesn't contains any duplicate data.
When creating a query in Microsoft Access , you might want to return only distinct or unique values , in such cases unique key is used.
Foreign key is defined in second table , but it refers to the primary key or unique key in first table.
___________________________
HOPE IT HELPS YOU MATE!
Answered by
3
primary key
1)primary key cannot have a null value.
2)each table have only one primary key.
3)primary key us related to another table as a foreign key
4) we can define primary key constraint or temporary table and table variable.
unique key
1) unique constraint may have a null value.
2)each table can more than one unique constraint.
3)by default,unique key is a unique non clustered index.
4) unique constraint cannot be related with another table as a foreign key.
foreign key
1) foreign key is a field in the table that is primary key in other table.
2)we can have more than one foreign key in a table.
3)we cannot define foreign key constraint on temporary table or table variable.
4)we can delete the foreign key value from the child table even though that refers to the primary key of the parent table.
1)primary key cannot have a null value.
2)each table have only one primary key.
3)primary key us related to another table as a foreign key
4) we can define primary key constraint or temporary table and table variable.
unique key
1) unique constraint may have a null value.
2)each table can more than one unique constraint.
3)by default,unique key is a unique non clustered index.
4) unique constraint cannot be related with another table as a foreign key.
foreign key
1) foreign key is a field in the table that is primary key in other table.
2)we can have more than one foreign key in a table.
3)we cannot define foreign key constraint on temporary table or table variable.
4)we can delete the foreign key value from the child table even though that refers to the primary key of the parent table.
Similar questions
Biology,
7 months ago
Social Sciences,
7 months ago
Accountancy,
1 year ago
Social Sciences,
1 year ago
Social Sciences,
1 year ago