Differentiate between Foreign key and Primary key.
Answers
Answered by
57
PRIMARY KEY → a primary key is a sort of check on that even that uniquely identifies each record in table it does not contain any duplicate data.
FOREIGN KEY → a foreign key is a value in one table that must watch the primary key of another table.
FOREIGN KEY → a foreign key is a value in one table that must watch the primary key of another table.
vaibhavkeshari303:
Thanks..
Answered by
24
1. the primary key is one or more columns in a table that are used to uniquely identify the row.
A Foreign key is a field in the table that is Primary key in another table.
2. Primary key can't accept null values. Whereas the foreign key can accept.
3. In primary key indexes are automatically created. Not possible in F.K
4. No duplicate values in the primary key. can have duplicate values in F.K
5. A table can have one primary key. Multiple foreign keys.
Hope this helps!
A Foreign key is a field in the table that is Primary key in another table.
2. Primary key can't accept null values. Whereas the foreign key can accept.
3. In primary key indexes are automatically created. Not possible in F.K
4. No duplicate values in the primary key. can have duplicate values in F.K
5. A table can have one primary key. Multiple foreign keys.
Hope this helps!
Similar questions