What is the difference between the Primary and Foreign key?

Answer Posted / suresh babu

Primary key and foreign key both are constraints.

Primary key:We can create only one primary key for a
table,which never allows the repeated or duplicate values
and null values.The index will be created when defining a
primary key.And primary key is used to make a relation
between more than one tables.

Foreign key:It allows the duplicate and null values.if we
want to make a relation between two tables,the parent table
column must have primary column and child table column
called foreign key.

Is This Answer Correct ?    7 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we use view in stored procedure?

506


Is pl sql and postgresql same?

571


What is synonyms?

573


How many columns should be in an index?

518


What is meant by <> in sql?

504






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

526


What is pl sql package?

591


What is an escape character in sql?

562


Why primary key is required?

555


How do I audit the sql sent to the server?

522


How is data stored on a disk?

538


Is pl sql a scripting language?

588


what is 'mysqlcheck'? : Sql dba

573


what is rollback? : Sql dba

591


what is try_catch block in procedure

1191