ON DELETE CASCADE CLAUSE
It is used on Foreign keys when we are assigning the Foreign Key on a particular column.
---It automatically deletes the values from the Foreign key Column if the primary
--key value is deleted.
Example:-if 100 is there in Primary Key Column and also there in the Foreign
--key Column , then if 100 is deleted on Primary key Column then 100 is automatically
deleted from Foreign key Column.
create table casdedemo
(sno int constraint pkm primary key,
sname varchar(10))
create table cascdata
(sno int constraint fk foreign key references casdedemo(sno) on delete cascade,
sales int)
---It automatically deletes the values from the Foreign key Column if the primary
--key value is deleted.
Example:-if 100 is there in Primary Key Column and also there in the Foreign
--key Column , then if 100 is deleted on Primary key Column then 100 is automatically
deleted from Foreign key Column.
create table casdedemo
(sno int constraint pkm primary key,
sname varchar(10))
create table cascdata
(sno int constraint fk foreign key references casdedemo(sno) on delete cascade,
sales int)
ON DELETE CASCADE CLAUSE
Reviewed by Rupesh
on
12:59
Rating:
No comments: