What is foreign key and pramary keys

1 answer

A primary key is a unique identifier for a record in a database table. It is used to uniquely identify each row in the table and should not be duplicated or null.

A foreign key is a field in a database table that is used to establish a link or relationship between two tables. It references the primary key of another table, creating a connection between the two tables. Foreign keys help maintain data integrity and enforce referential integrity, ensuring that the data between related tables remains consistent.