Sunday, 29 March 2015

Difference between Primary key and Foreign key


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
1- Primary key uniquely identify a record in the table
1- Foreign key is a field in the table that is primary key in another table
2-  Primary Key can't accept null values
2- Foreign key can accept multiple null values.
3- We can have only one Primary key in a table.
3- We can have more than one foreign key in a table

No comments:

Post a Comment