What is the difference between the Primary and Foreign key?

Answer Posted / dhirendra

Primary Key: This is a constraint which is always unique &
not null.

Foreign Key: This is a constraint which is just opposite to
Primary key. It can be not Null & can accept duplicate value
as well. Foreign key points to same table's primary key or
another table's primary key to make a relationship.

Is This Answer Correct ?    12 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a subquery in sql?

497


Can we write dml inside a function in sql server?

491


What does := mean in pl sql?

548


What are the different types of dbms?

543


Define overloaded procedure?

616






Which is better cte or subquery?

534


How do I truncate a word?

514


Why we use triggers in mysql?

555


Which language is used in sql?

514


what is a foreign key ? : Sql dba

599


what are the limitations of identity column? : Transact sql

600


How do I remove sql developer from windows 10?

501


How does sql*loader handles newline characters in a record? : aql loader

580


When are we going to use truncate and delete?

545


What is sql resultset?

523