IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

DB2 Question - Choose the best


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
CIS777
Currently Banned

New User


Joined: 16 Sep 2005
Posts: 6

PostPosted: Sat Sep 24, 2005 7:17 am
Reply with quote

TABLEA has the following primary key definition:
PRIMARY KEY ( COL1 )
TABLEB has the following foreign key definition:
FOREIGN KEY FK1 ( COLY ) REFERENCES TABLEA ON DELETE CASCADE
What is the result when the SQL UPDATE statement below is executed?
DELETE FROM TABLEA WHERE COL1 = HV1

A. The delete will fail because a primary key value cannot be deleted.

B. The row will be deleted in all cases.

C. The row will be deleted from TABLEA and all rows from TABLEB where COLY = HV1 will also be deleted.

D. The row will be deleted only if no rows exist in TABLEB where COLY = HV1.

E. The row will be deleted only if a separate delete statement is executed before the next COMMIT, deleting all rows from TABLEB where COLY = HV1 if any such rows exist.
Back to top
View user's profile Send private message
chowdamhemalatha

New User


Joined: 25 Sep 2005
Posts: 2
Location: bangalore

PostPosted: Sun Sep 25, 2005 8:04 pm
Reply with quote

Hi,
option C is correct one.

ON DELETE CASCADE means whenever a row in PARENT table (TABLEA) is requested to delete, corresponding rows in all child tables dependent on the parent table (TABLEA) will be deleted. This cascade applies to all lower level child tables that are inturn depent on TABLEB using ON DELETE CASCADE option.

Regards,
Hema.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Question for file manager IBM Tools 7
No new posts question for Pedro TSO/ISPF 2
No new posts question on Outrec and sort #Digvijay DFSORT/ICETOOL 20
No new posts panel creation question TSO/ISPF 12
No new posts Sort w/OUTREC Question DFSORT/ICETOOL 2
Search our Forums:

Back to Top