Recall & Review
beginner
What is an AFTER trigger in SQL?
An AFTER trigger is a database trigger that runs automatically after a specified data modification event like INSERT, UPDATE, or DELETE has completed successfully.
Click to reveal answer
beginner
When does an AFTER trigger execute in relation to the triggering SQL statement?
An AFTER trigger executes only after the triggering SQL statement has completed successfully.
Click to reveal answer
intermediate
Can an AFTER trigger modify the data that caused it to fire?
No, AFTER triggers cannot modify the data that caused them to fire because the original statement has already completed. They can only perform additional actions like logging or cascading changes.
Click to reveal answer
beginner
Give an example use case for an AFTER trigger.
An AFTER trigger can be used to log changes to a table by inserting a record into an audit table after a row is inserted or updated.
Click to reveal answer
intermediate
What happens if an AFTER trigger fails during execution?
If an AFTER trigger fails, the entire transaction that fired the trigger is rolled back, undoing the original data modification.
Click to reveal answer
When does an AFTER trigger run in SQL?
✗ Incorrect
AFTER triggers run only after the triggering data modification statement (INSERT, UPDATE, DELETE) completes successfully.
Which of the following can an AFTER trigger NOT do?
✗ Incorrect
AFTER triggers cannot modify the data that caused them to fire because the original statement has already completed.
If an AFTER trigger fails, what happens to the original data change?
✗ Incorrect
If an AFTER trigger fails, the entire transaction including the original data change is rolled back.
Which SQL events can an AFTER trigger be defined on?
✗ Incorrect
AFTER triggers are commonly defined on data modification events: INSERT, UPDATE, and DELETE.
What is a common use of AFTER triggers?
✗ Incorrect
AFTER triggers are often used to log audit information or perform actions after data changes.
Explain what an AFTER trigger is and when it executes in a database.
Think about what happens after you save changes in a spreadsheet.
You got /3 concepts.
Describe a practical scenario where you would use an AFTER trigger and why.
Consider tracking changes after they happen.
You got /3 concepts.