top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

What are the difference between primary keys and foreign keys?

+2 votes

Hai,friends anybody say about the difference between primary keys and foreign keys

posted Nov 14, 2014 by Balu

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+2 votes

The primary key is the columns used to uniquely identify each row of a table.It can not accept null,duplicate values. A table can have only one primary key.
Foreign keys are both a method of ensuring data integrity and a manifestation of the relationship between tables. It is a field in database table is primary key in another table. It can accept multiple null,duplicate values.

answer Nov 14, 2014 by Manikandan J
+1 vote
  • Primary key is used to search a record in a database table.
  • Foreign key is used to refer primary key of the another table.
    In short, if both the tables are related to each other then it is used.
answer Nov 14, 2014 by Neeraj Mishra
Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.