Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...

What is the difference between the Primary and Foreign key?

Answers were Sorted based on User's Feedback

What is the difference between the Primary and Foreign key?..

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

What is the difference between the Primary and Foreign key?..

Primary key is unique index and non null coulum in a table.
While foreign key can have repeated values.

 Is This Answer Correct ? 9 Yes 1 No

What is the difference between the Primary and Foreign key?..

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

What is the difference between the Primary and Foreign key?..

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

What is the difference between the Primary and Foreign key?..

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 ? 3 Yes 1 No

What is the difference between the Primary and Foreign key?..

Primary key uniquely identified a record in a table and dont have null values. Also when we create primary key an index is automatically created for primary key.
On the other hand foreign key is used for referential integrity, foreign key can points to primary key in other table and moreover index is not created for foreign key.

 Is This Answer Correct ? 0 Yes 0 No

What is the difference between the Primary and Foreign key?..

Primary key will checks for the Duplicates.
Can hold only one primary key for a single table.

Foreign key will be referred from the Primary/unique Key
constraint. Hold even null values in it.

 Is This Answer Correct ? 0 Yes 0 No

More SQL PLSQL Interview Questions

how to select alphabets in a one column , for this the table name is PA_TASKS and column name is TASK_NUMBER, In TASK_NUMBER the data like this 1.1.3NN,1.1.4NN,1.5.1NN,1.3.2NE,1.5NN,1NN,1.2NE,1CE , For this i need to disply output as NN,NN,NN,NE,NN,NN,NE,CE, Its some urgent requirement ,thanks in advance

What is rank () in sql?

How to fix oracle error ora-00942: table or view does not exist

What is the difference between sum and count in sql?

Which is faster union or join?

Can I create table without primary key?

Do triggers have restrictions on the usage of large datatypes, such as long and long raw?

What is cost in sql execution plan?

What does cursor do in sql?

How do I debug a stored procedure?

what is sql in mysql? : Sql dba

What is an oracle stored procedure?

Categories