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

how to present a past time in hours, minutes and seconds? : Sql dba

0 Answers  


How do I run a pl sql program?

0 Answers  


How to find only %th Highest Sal

6 Answers   Infogain, Symphony,


What are the different types of sql commands?

0 Answers  


Write a query to get 2nd maximum salary in an employee table ?

69 Answers   Accenture, BirlaSoft, Letse, Logica CMG, Qwest, Rheal Software, Saagam, Semantic Space, Tailor Solution, TCS, TinyERP,






Should I use mbr or gpt?

0 Answers  


How do I access sql anywhere database?

0 Answers  


What is foreign key in sql with example?

0 Answers  


what is the difference between clustered and non clustered index in sql? : Sql dba

0 Answers  


What are different types of tables in sql?

0 Answers  


what are rollup and cube in t-sql? : Transact sql

0 Answers  


what is a unique key ? : Sql dba

0 Answers  


Categories