GeekInterview.com
Series: Subject:
Question: 62 of 234

Delete contents in two tables at a time

How to delete contents in two tables at a time? When you delete contents in one table then other table contents should also be deleted.
Asked by: jyothivdaru | Member Since Feb-2008 | Asked on: Apr 9th, 2008

View all questions by jyothivdaru

Showing Answers 1 - 4 of 4 Answers
tariq_oracle

Answered On : Apr 13th, 2008

View all answers by tariq_oracle

with the use of on delete cascade clause
when we deete the parent record child record will be deleted automaticaly

  
Login to rate this answer.
abc.abc555

Answered On : Jun 19th, 2008

View all answers by abc.abc555

ON DELETE CASCADE clause with a FOREIGN KEY constraint specifies that when a row in the parent table is deleted, any matching rows in the child table are also deleted.

Yes  1 User has rated as useful.
  
Login to rate this answer.

You may also use triggers for this purpose. But specifying on delete cascade while defining foreign key constraint is better option.

  
Login to rate this answer.
sampra

Answered On : Mar 6th, 2012

View all answers by sampra

1> always avoid select * from
2> do not use in operator

  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.