Hi Dear,
This article we will discuss what is the difference between primary key and
Foreign key. It is also a common interview question. Most of time at interview you will face this question.
|
Primary key |
Foreign Key |
|
Primary key uniquely identify a record in the table |
Foreign key is a field in the table that is primary key in another table |
|
Primary Key can't accept null values |
Foreign key can accept multiple null values. |
|
We can have only one Primary key in a table. |
We can have more than one foreign key in a table |

Join the conversation! Your thoughts help the community grow.