What is the difference between the Primary and Foreign key?

Answers were Sorted based on User's Feedback



What is the difference between the Primary and Foreign key?..

Answer / dhirendra

Primary Key: This is a constraint which is always unique &
not null.

Foreign Key: This is a constraint which is just opposite to
Primary key. It can be not Null & can accept duplicate value
as well. Foreign key points to same table's primary key or
another table's primary key to make a relationship.

Is This Answer Correct ?    12 Yes 2 No

What is the difference between the Primary and Foreign key?..

Answer / suma

Primary key is unique index and non null coulum in a table.
While foreign key can have repeated values.

Is This Answer Correct ?    9 Yes 1 No

What is the difference between the Primary and Foreign key?..

Answer / suresh babu

Primary key and foreign key both are constraints.

Primary key:We can create only one primary key for a
table,which never allows the repeated or duplicate values
and null values.The index will be created when defining a
primary key.And primary key is used to make a relation
between more than one tables.

Foreign key:It allows the duplicate and null values.if we
want to make a relation between two tables,the parent table
column must have primary column and child table column
called foreign key.

Is This Answer Correct ?    7 Yes 0 No

What is the difference between the Primary and Foreign key?..

Answer / slokh

Primary key does not contain NULL or duplicate values.
whereas Foreign key accepts duplicate values but not null
values.
Primary key states the Entity integrity constraint, which
says that every row in a table is unique.
Foreign key states the referential integrity constraint,
that says that you can only insert values that is present
in the primary of the parent table.

Is This Answer Correct ?    8 Yes 2 No

What is the difference between the Primary and Foreign key?..

Answer / dhirendra

Primary Key: This is a constraint which is always unique &
not null.

Foreign Key: This is a constraint which is just opposite to
Primary key. It can be not Null & can accept duplicate value
as well. Foreign key points to same table's primary key or
another table's primary key to make a relationship.

Is This Answer Correct ?    3 Yes 1 No

What is the difference between the Primary and Foreign key?..

Answer / nitin

Primary key uniquely identified a record in a table and dont have null values. Also when we create primary key an index is automatically created for primary key.
On the other hand foreign key is used for referential integrity, foreign key can points to primary key in other table and moreover index is not created for foreign key.

Is This Answer Correct ?    0 Yes 0 No

What is the difference between the Primary and Foreign key?..

Answer / dinesh kumar

Primary key will checks for the Duplicates.
Can hold only one primary key for a single table.

Foreign key will be referred from the Primary/unique Key
constraint. Hold even null values in it.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL PLSQL Interview Questions

Can function return multiple values in sql?

0 Answers  


Which tcp/ip port does sql server run on? How can it be changed? : Sql dba

0 Answers  


What is java sql driver?

0 Answers  


what is innodb? : Sql dba

0 Answers  


Is it possible to link two groups inside a cross products after the cross products group has been created?

0 Answers  






What is the difference between local variables and global variables?

0 Answers  


Is like operator in sql case sensitive?

0 Answers  


How can we overcome recursive triggers in SQL?

1 Answers   iFlex,


Can you have more than one trigger on a table?

0 Answers  


what are pl/sql collections?

4 Answers   JPMorgan Chase, Oracle,


what is the purpose of update command in oracle?

7 Answers   MBT,


What is the difference between the repeatable read and serializable isolation levels? : Transact sql

0 Answers  


Categories