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

Can we insert data into materialized view?

498


How do I clear the screen in sql plus?

538


how many ways we can we find the current date using mysql? : Sql dba

605


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

522


What is group function in sql?

523






What is nvarchar max in sql?

572


what is sp_pkeys? : Transact sql

688


Is there a 64 bit version of ssms?

506


What is trigger in pl sql with examples?

511


How to get unique records from a table?

514


What are the different type of joins in sql?

536


What is sql*loader?

563


Can we use loop in sql?

527


What is %s in sql?

557


How we can update the view?

593