Delete Actions
Ø Delete Actions are 4 types.
o None
o Cascade.
o Restricted.
o Cascade+Restricted.
Ø None: if we
give None. Child table not affected.
Ø Cascade: if we
give cascade. When I go to delete record from parent table. It’s showing Msg”
Are you want to delete records” if select Yes then it will delete records from
parent and child both Records.
Ø Restricted: if
we give Restricted. When I go to delete record from parent table. It won’t
delete. It’s showing Msg “Error Message” Then we will go to delete Child table
Record and delete Parent Table Record.
Ø Cascade+Restricted: it Having 3 tables parent, child, sub-child.
Ø So if I delete record in child table
then it will first check the record exists in sub-child table. If exists
through warning prompt. saying that first we need to delete record from sub
child table.
Ø But if I delete a record from parent
table.it will automatically delete record in all tables.
Note: Delete
Actions have given in parent table.
Relations have given Child Table.
I Have a 3 tables.
1.parent
2.Child
3.SubChild
I gave a Normal relation parent table to Child table and
Child table to Subchild table.
And then I gave a delete action for parent table to child
table and Child Table to sub Child table.
Example:
In Parent Table: I have these fields.
In Child Table: I have these fields.
In Sub Child Table: I have these fields.
Ø we
will apply Cascade Delete action on
Parent table. using Cascade Delete Action. When I go to delete record from parent table. It’s showing Msg” Are you
want to delete records” if select Yes then it will delete records from parent
and child both Records.
Ø Once
Delete Parent Table record of P_100. It
will delete in Child Table record of p_100.
Ø we
will apply Restricted
Delete action on Parent table. if
we give Restricted. When I go to delete record from parent table. It won’t
delete. It’s showing Msg “Error Message” Then we will go to delete Child table
Record and delete Parent Table Record.
Ø we
will apply Cascade + Restricted Delete Action.: it Having 3
tables parent, child, sub-child.
Ø Here
we will give Cascade in parent table and Cascade + restricted in Child Table.
Ø Cascade
+ Restricted it works like a Restricted.
Ø So if I delete record in child table
then it will first check the record exists in sub-child table. If exists
through warning prompt. saying that first we need to delete record from sub
child table.
Ø But if I delete a record from parent
table.it will automatically delete record in all tables.
Clear explanation
ReplyDelete