Jigar Khatri
Answered On : Mar 28th, 2007
Hi,
Answer is :
Foreign Key can not reduce redundacy in DB as it supports duplicate as well as NULL values.
But it is very useful to maintain the Referencial Integrity (Foreign Key Constrints) in DB.
Thank you. (If you have any different asnwers please post it)
Login to rate this answer.
i think it can reduce reduncency.
suppose we have a table
table :orders
--------------------------
customer_id order_no customer_address
---------------------------------------------------------------
1 O11 US
2 O22 UK
3 O33 IND
1 O44 US --> duplicate
3 O55 IND --> duplicate
------------------------------------------------------------------
here customers 1,3 made two orders. so the customer_address is duplicated for each order.
we can resolve this by foreign key integrity.
table : orders
-----------------------------------------
customer_id order_no | here customer_id is FOREIGN KEY
-----------------------------------------
1 O11
2 O22
3 O33
1 O44
3 O55
--------------------------------------------
table : address
----------------------------------------
customer_id address | Here customer_id is PRIMARY KEY
---------------------------------------
1 US
2 UK
3 IND
------------------------------------------
now we can select as
select
o.customer_id,
o.order_no,
a.address
from
orders o,
address a
where
o.customer_id = a.customer_id
Login to rate this answer.
A column included in the definition of referential integrity which would refer to a referenced key.
Referenced key is a primary key which is combination of UNIQUE+NOT NULL".
Login to rate this answer.