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

How do you rename a table in sql?

734


what is a table called, if it has neither cluster nor non-cluster index? What is it used for? : Sql dba

711


Why procedure is used in sql?

754


name 3 ways to get an accurate count of the number of records in a table? : Sql dba

787


What is mutating sql table?

824






How do you optimize a stored procedure query?

732


Is a foreign key always unique?

677


What is sql procedures and functions?

745


What are local and global Indexes and where they are useful.

1133


Is oracel sql developer written in java?

837


What is the difference between database trigger and stored procedure?

738


Why cross join is used?

822


what is a materialized view? : Sql dba

748


Is there a way to automate sql execution from the command-line, batch job or shell script?

746


How to create your own reports in sql developer?

729