what is the Foreign key? explain?

Answers were Sorted based on User's Feedback



what is the Foreign key? explain? ..

Answer / gowrinag


FOREIGN KEY YFK (YNO) REFERENCES Y
ON DELETE CASCADE,
FOREIGN KEY ZFK (ZNO) REFERENCES Z
ON DELETE RESTRICT)
IN OZAGENDB.OZAGENTS;

ex:

CREATE TABLE YZ
(YNO CHAR(5) NOT NULL,
ZNO CHAR(5) NOT NULL,
QTYINTEGER,
PRIMARY KEY (YNO,ZNO),
FOREIGN KEY YFK (YNO) REFERENCES Y
ON DELETE CASCADE,
FOREIGN KEY ZFK (ZNO) REFERENCES Z
ON DELETE RESTRICT)
IN OZAGENDB.OZAGENTS;


---------+---------+---------+---------+---------
YNO ZNO QTY
---------+---------+---------+---------+--------
Y1 Z1 300
Y2 Z2 400

Is This Answer Correct ?    2 Yes 1 No

what is the Foreign key? explain? ..

Answer / guest

A foreign key establishes the referential constraint
between a parent table and a dependent table

Is This Answer Correct ?    3 Yes 3 No

Post New Answer

More DB2 Interview Questions

When is the authorization check on DB2 objects done - at BIND time or run time?

1 Answers  


What are the disadvantages of using VARCHAR?

3 Answers  


How to find the number of rows in db2 tables?

0 Answers  


What is the purpose of the WHENEVER statement?

1 Answers  


what is the process of precompiler?

2 Answers  






Which transaction use a command thread ?

1 Answers  


What happens to a tablespace when its recovery infromation has been removed and a full recovery is no longer possible?

2 Answers  


Hi Dude,this is Ram.could any one tell me aboue CURRENT OF clause in DB2. Thanks in advance.......

2 Answers  


in a table consist of 1000 records among that i was updated 145 record how could i know that ..list of recently updated record's and where could i see those updated record's....pls help me out....

4 Answers   Infosys,


cursor with hold explain ?

1 Answers   Verizon,


What is the result of open cursor statement?

0 Answers  


Consider that a package is bound into 2 different collections and the PKLIST option specifies both the collections. If the collection id is not specified in the program while executing the SQL query, then when the DB2 system will search the package list, which collection will it pick up or will it give an error/abend?

1 Answers  


Categories