What is the difference between the Primary and Foreign key?

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is sql important?

575


how can we encrypt and decrypt a data present in a mysql table using mysql? : Sql dba

631


what are date and time data types? : Sql dba

529


what is a trigger in mysql? Define different types of trigger. : Sql dba

541


Can we rename a column in the output of sql query?

536






What is a temporal data type?

584


What is data types in sql?

526


What does where 1 1 mean in sql?

530


Is sql a backend?

536


Why do we need databases?

555


What are character functions in sql?

484


Are sql connections encrypted?

544


What is the use of sqlerrd 3?

511


What is string join?

546


What is field delimiter?

625