CREATE PROCEDURE `spDeleteInstitute` ( IN `P_InstituteId` INTEGER ) BEGIN DELETE `tta` , `ttc` FROM `tteachercontent` `ttc` LEFT JOIN `tteachercontentassign` `tta` ON `tta` . `TeacherContentId` = `ttc` . `Id` LEFT JOIN `tstudymaterialcomment` `tsc` ON `tsc` . `AssignContentId` = `tta` . `TeacherContentId` INNER JOIN `tteacher` `tt` ON `tt` . `Id` = `ttc` . `TeacherId` WHERE `tt` . `InstituteId` = `P_InstituteId` ; DELETE `tpq` FROM `tetest` `te` LEFT JOIN `tparaquestions` `tpq` ON `tpq` . `testId` = `te` . `Id` INNER JOIN `tteacher` `tt` ON `tt` . `Id` = `te` . `CreatedUserId` WHERE `tt` . `InstituteId` = `P_InstituteId` ; DELETE `te` , `ttq` , `ttqo` , `tsa` , `tr` FROM `tetest` `te` LEFT JOIN `tetestquestions` `ttq` ON `ttq` . `TestId` = `te` . `Id` LEFT JOIN `tetestquestionoptions` `ttqo` ON `ttqo` . `QuestionId` = `ttq` . `Id` LEFT JOIN `teteststudentanswer` `tsa` ON `tsa` . `TestId` = `te` . `Id` LEFT JOIN `tresult` `tr` ON `tr` . `TestId` = `te` . `Id` INNER JOIN `tteacher` `tt` ON `tt` . `Id` = `te` . `CreatedUserId` WHERE `tt` . `InstituteId` = 