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

Where is sql database stored?

689


What are character functions?

804


What is cursor in pl sql with examples?

674


what is collation? : Sql dba

800


what is 'mysqlshow'? : Sql dba

756






how to add a new column to an existing table in mysql? : Sql dba

777


what is bdb (berkeleydb)? : Sql dba

755


Is left join inner or outer?

759


How do I run a pl sql program?

802


What are different methods to trace the pl/sql code?

742


What is nested table in pl sql?

748


What is the difference between database trigger and stored procedure?

743


How do you explain an index?

988


What is the difference between numeric and autonumber?

705


What are different types of indexes?

706