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

What are the datatypes a available in PL/SQL ?

2 Answers  


discuss about myisam index statistics collection. : Sql dba

0 Answers  


What is pl sql record in oracle?

0 Answers  


What is the difference between left join and left outer join?

1 Answers  


What is t sql used for?

0 Answers  






Is join an inner join?

0 Answers  


what are the types of subquery? : Sql dba

0 Answers  


How does stored procedure reduce network traffic?

0 Answers  


What is view explain with example?

0 Answers  


How to fetch alternate records from a table?

0 Answers  


What are the types of optimization?

0 Answers  


how is exception handling handled in mysql? : Sql dba

0 Answers  


Categories