What are the advantages and disadvantages of primary key and foreign key in SQL?

Showing Answers 1 - 3 of 3 Answers

Sheena

  • Jul 6th, 2006
 

Primary key

  Advantages

  1) It is a unique key on which all the other candidate keys are functionally dependent

Disadvantage

1) There can be more than one keys on which all the other attributes are dependent on.

Foreign Key

Advantage

1)It allows refrencing another table using the primary key for the other table

  Was this answer useful?  Yes

Disadvantages:

On primary key index will be created so during updation of table index need to be adjusted accordingly. this process makes the updation slower.

  Was this answer useful?  Yes

qptopm

  • Sep 9th, 2016
 

Foreign keys are both a method of ensuring data integrity and a manifestation of the relationship between tables. It is also known as referential integrity.
Foreign Key is a field in database table that is Primary key in another table. It can accept multiple null, duplicate values. We can have more than one foreign key in a table.
Foreign key do not automatically create an index, clustered or non-clustered. You can manually create an index on foreign key.
http://qualitypointtech.net/forum/viewtopic.php?f=14&t=8395

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Answer Question

Click here to Login / Register your free account


 
Send   Reset

 

Related Answered Questions

 

Related Open Questions