What is the Difference between a Primary Key and a Foreign Key? - LearnHowToCode SarkariResult.com Interview Questions and Answers LearnHowToCodeOnline
What is the Difference between a Primary Key and a Foreign Key?

What is the Difference between a Primary Key and a Foreign Key?

What is the Difference between a Primary Key and a Foreign Key?


Difference between Primary Key and Foreign Key:-

Primary Key:- Primary Key is a column/columns in a table which can uniquely identify the records, it never accepts the duplicate value and never accept null values.

Foreign Key:- Foreign Key is a column/columns in the table which is already defined as a primary/unique key in an another/same table.

1) Primary Key is used for uniquely identified the record whereas the Foreign key is to ensure the column values referenced from Primary key column

2) Primary Key never accept Null value whereas Foreign Key accept Null Value

3) In a table, only 1 Primary Key can be defined whereas more than 1 foreign key can be defined in a table.

4) Primary never accept duplicate values whereas Foreign accept duplicate records

About Mariano

I'm Ethan Mariano a software engineer by profession and reader/writter by passion.I have good understanding and knowledge of AngularJS, Database, javascript, web development, digital marketing and exploring other technologies related to Software development.

0 comments:

Featured post

Political Full Forms List

Acronym Full Form MLA Member of Legislative Assembly RSS Really Simple Syndication, Rashtriya Swayamsevak Sangh UNESCO United Nations E...

Powered by Blogger.