Re: onDelete cascade after table has been created

From: J.O. Aho <user_at_example.net>
Date: Sat, 20 Feb 2016 09:57:06 +0100
Message-ID: <diqo32FbfdpU1_at_mid.individual.net>


On 02/20/2016 07:10 AM, apoorv.kanungo_at_gmail.com wrote:
> Hello I know we can use cascading while creating table but After I created table and there are bunch of data in it how would I do ondelete cascade.

You have specified that delete rows when the user is deleted

delete from user where id = 12

will delete the rows in article too. No extra queries to execute or other commands, you have already defined the behaviour when you created the tables, without the on delete cascade, you wouldn't be able to delete the user until you had deleted the articles first.

-- 

 //Aho
Received on Sat Feb 20 2016 - 09:57:06 CET

Original text of this message