top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What are the difference between primary keys and foreign keys?

+2 votes
583 views

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
...