Sql query

developer trilochan
develop...
4 Points
2 Posts

Delete two table data having single sql query first table id field is work as forign key i am not using forign key constaints. Is it possible to delete without constaints. 

Views: 9716
Total Answered: 1
Total Marked As Answer: 0
Posted On: 16-Feb-2017 11:46

Share:   fb twitter linkedin
Answers
Rahul Maurya
Rahul M...
4916 Points
27 Posts
         

If you are not using foreign key constraints , you could do two statements on a single command:

DELETE FROM ChildTable; DELETE FROM ParentTable;

But in effect that is two statements.

Or

You could put a trigger on the ChildTable that deletes parent records on deletion of child record.

I think it will help you. If you are trying any query, post query.

 

Posted On: 16-Feb-2017 22:59
 Log In to Chat