State the relationship and difference between primary key and foreign key.
Answers
Answered by
341
Primary Key is field or group of fields which identify records uniquely
Foreign Key refers to primary key field of another Table in relationship.
The primary key relationship is One to Many relationship
Foreign Key refers to primary key field of another Table in relationship.
The primary key relationship is One to Many relationship
Answered by
264
Explanation:
A primary/candidate key is a group of attributes which distinctly determine the records in a relation. However, a "foreign key" in a table points to the "primary key" of another table.
A primary key acts as a unique identifier for each record meaning it uniquely identifies each row/record in a table. "A foreign key" is a field in one table that relates the tables together.
The primary key attributes cannot have NULL values however; a foreign key can have a NULL value.
In relation, a table will have only "one primary key", but foreign keys can be multiple.
Similar questions