title: MYSQL trigger for Cascading Delete : Workaround needed
body: <p>Consider 3 Tables -  </p>
  
  <pre><code>Student(Id INT NOT NULL PRIMARY KEY, Name VARCHAR(100));
  Test(Id INT NOT NULL PRIMARY KEY, Name VARCHAR(50), MaxMarks INT, TestDate DATETIME);  
  StudentTakesTest(TestId INT NOT NULL REFERENCES Test(Id), StudentId INT NOT NULL REFERENCES Student(Id), MarksObtained FLOAT, MarksObtainedInPercentage FLOAT);
  </code></pre>
  
  <p>Every time a student takes test, the average of all the tests taken by a particular student is stored in an index table. I am doing this with the help of triggers. </p>
  
  <p>I have applied 3 triggers on <code>StudentTakesTest</code> table that is <code>AFTER INSERT</code>, <code>AFTER UPDATE</code> and <code>AFTER DELETE</code>. The INSERT and UPDATE Triggers are firing since the actions are done directly on the StudentTakesTest table. The DELETE trigger won't fire since the action is not directly on the <code>StudentTakesTest</code> table, it is a Cascading delete that happens when an entry in the <code>Test</code> table is deleted.</p>
  
  <p>Is there a work around or a logic that could help me run the trigger on Cascading Delete of the table entries as well?</p>