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

How to change sql*plus system settings?

544


What is view explain with example?

519


how to dump a table to a file with 'mysqldump'? : Sql dba

555


What are sql commands?

505


What are operators available in sql?

587






How long it takes to learn pl sql?

533


What is sqlerrm?

548


What is the use of nvl function?

619


How do you bind variables in pl sql?

580


Is delete faster than truncate?

547


Cite the differences between execution of triggers and stored procedures?

622


What is the difference between partitioning and sharding?

528


how to get @@error and @@rowcount at the same time? : Sql dba

529


what are the disadvantages of mysql? : Sql dba

574


Does mysql support pl sql?

624