what is the difference between primary key & foreign key?
Answers were Sorted based on User's Feedback
Answer / vij&pani
Primary key is unique key but foriegn key always refers to
primary key
| Is This Answer Correct ? | 327 Yes | 50 No |
Answer / ramprakash
Primary keys enforce entity integrity by uniquely
identifying entity instances. Foreign keys enforce
referential integrity by completing an association between
two entities.
| Is This Answer Correct ? | 275 Yes | 50 No |
Answer / guest
Primary key is unique
primary key is not NULL and
foreign key is NULL
foreign key reference as Primary key in another table
| Is This Answer Correct ? | 250 Yes | 62 No |
Answer / guest
primary key is used to identify a row and it doesnot allow
null values. It avoids duplication of rows.
whereas foreign key refers to a column or combination of
columns included in the defenition of referential integrity.
| Is This Answer Correct ? | 155 Yes | 19 No |
Answer / muneer
Primary Key is unique Key entire the table and which is
also NOT NULL
where as foriegn key is the null & which references the
primary key .
| Is This Answer Correct ? | 147 Yes | 28 No |
Answer / shaik gouse peer
Basic difference betweeen Primary key and foreign key is :
Primary key will not allow "Null values" and "Duplicate
values"
Foreign key will allow "Null values" and "Duplicte values"
and it refers to a primary key in anoter table.
| Is This Answer Correct ? | 130 Yes | 25 No |
Answer / guest
primary key is the parent and foreign is the child.
| Is This Answer Correct ? | 132 Yes | 73 No |
Answer / hardik patel
primary key is used to identify a row and it doesnot allow
null values. It avoids duplication of rows.
whereas foreign key refers to a column or combination of
columns included in the defenition of referential integrity.
| Is This Answer Correct ? | 65 Yes | 20 No |
Answer / gaurav , ashish ,preeti , main
Primary key is used to identify a row in a table and it
doesnot allow null values. It avoids duplication of rows.
whereas foreign key refers to a column or combination of
columns included in the defenition of referential integrity
| Is This Answer Correct ? | 57 Yes | 16 No |
Answer / raghu
In the context of relational databases, a foreign key is a
referential constraint between two tables.[1] The foreign
key identifies a column or a set of columns in one
(referencing) table that refers to a column or set of
columns in another (referenced) table. The columns in the
referencing table must form a primary key or unique key.
| Is This Answer Correct ? | 58 Yes | 20 No |
WHT ARE THE AGGREATE FUNCTIONS?
What is the fastest query method to fetch data from the table?
What is a read only transaction in oracle?
What is an oracle table?
how can find the second max sal for every group(i.e i want group the data based on key and find the second max sal for every group
How can we find out the duplicate values in an oracle table?
How does the on-delete-cascade statement work?
What are the extensions used by oracle reports?
How to find out what privileges a user currently has in oracle?
How data locks are respected in oracle?
What is a deadlock in SQL? How can you prevent it?
How to update rows in table, suppose i have lacks of rows in table how to update total table with update statement. Can u please any one answer this question with update statement.