Adding Triggers to the Critique Table

Every time you delete or update a critique in the Critique table, the average overall rating column (avg_rating) in the title table is recalculated. It is not necessary to recalculate the rating when you add a critique because critique records are always updated before their content is used by the library application. The default value of the isApproved column is False, and the overall rating in the Critique table is not included in the calculation of the average overall rating (in the title table) until the Critique table is updated and the isApproved column is set to True.

To support this functionality, the following two triggers were added: