what is primary key,unique key, foreign key? can u teach me
in simple language?

Answer Posted / mansi valani

A Foreign Key is a field in a relational table that matches
a candidate key of another table. The foreign key can be
used to cross-reference tables.
The foreign key identifies a column or 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 reference the columns of the primary
key or other superkey in the referenced table. The values in
one row of the referencing columns must occur in a single
row in the referenced table. Thus, a row in the referencing
table cannot contain values that don't exist in the
referenced table (except potentially NULL). This way
references can be made to link information together and it
is an essential part of database normalization. Multiple
rows in the referencing table may refer to the same row in
the referenced table. Most of the time, it reflects the one
(parent table or referenced table) to many (child table, or
referencing table) relationship.

The referencing and referenced table may be the same table,
i.e. the foreign key refers back to the same table. Such a
foreign key is known in SQL:2003 as a self-referencing or
recursive foreign key.

A table may have multiple foreign keys, and each foreign key
can have a different referenced table. Each foreign key is
enforced independently by the database system. Therefore,
cascading relationships between tables can be established
using foreign keys.

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What happens when shared and exclusive locks are applied on data item?

597


Which Statement would you use to remove the EMPLOYEE_Id_PK PRIMARY KEY constraint and all depending constraints from the EMPLOYEE table?

700


How does database replication work?

562


How to do Data size testing? Who does this testing (Developer or tester)?

2129


What is database server and how it works?

557






What is ase database?

557


What is the use of graph database?

553


What are the concurrency problems a database faces?

562


query to Compare data of two tables between two different Databases(Oracle and SQL Server) Eg., Source Database: Oracle Table: Employee Target Database : SQL Server Table : emp

1643


I have single column in a file. Input 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 my output is file 1 have 1,2,3,10,11,12 file 2 have 4,5,6,13,14,15 and file 3 have 7,8,9 how is it possible in datastage

1196


Write a query to get maximum and second maximum in oracle?

604


What is ole db used for?

586


i have windows-xp processor with P4 system. whenever I tried to download foxpro for windows 2.6 on windows XP, my operating system failed to install foxpro for windows 2.6.please. how could i download , install & run foxpro for windows 2.6 easily on windows XP ?

1642


What is the difference between primary and candidate key?

580


Explain normalization in one line?

642