What is the difference between the Primary and Foreign key?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between sql and excel?

693


Is drop table faster than truncate?

739


How many triggers can be applied on a table?

672


What are different sql data types?

685


What is the difference between partitioning and sharding?

730






What is keys and its types?

747


What is sql server and ase?

711


What are sql indexes?

740


how to get a list of indexes of an existing table? : Sql dba

711


What is query execution plan in sql?

772


What are all the different normalizations?

741


What is sql entity?

740


What does rownum mean in sql?

721


Are stored procedures faster than queries?

695


Can I learn sql in a week?

753