--Follow step by step
--step1 Create parent table
Create table Department (Deptid int constraint PK_Department primary key,
DepartmentName varchar(100))
insert into Department select

--step2 insert values
1,'Finance'
insert into Department select 2,'Marketing'

--step3 Create child table

Create table Employee (empid int constraint PK_Employee primary key,
Fname varchar(50), Lname varchar(50), Deptid int constraint FK_Department references
DepartMent(deptid) on delete cascade on Update cascade )

--step4 insert values
insert into Employee select 1,'Sam','rooban',1
insert into Employee select 2,'Amar','Kumar',NULL
insert into Employee select 3,'Kumar','Sanu',2

--step5 Update parent table

update department set deptid=5 where deptid=2

--step 6. see the change

select * from employee

--step 7. Delete a row in the parent table

delete department where deptid=5

--step 6. see the change

select * from employee