Recall & Review
beginner
What is a trigger in a database?
A trigger is a special kind of stored procedure that automatically runs when certain events happen in the database, like inserting, updating, or deleting data.
Click to reveal answer
beginner
Why do we need triggers in databases?
Triggers help automate tasks, keep data consistent, enforce rules, and react to changes without needing manual intervention.
Click to reveal answer
beginner
Give an example of a situation where a trigger is useful.
For example, when a new order is added, a trigger can automatically update the stock quantity so the data stays accurate.
Click to reveal answer
intermediate
How do triggers help maintain data integrity?
Triggers can check or change data automatically when it is added or changed, making sure the data follows the rules set by the database.
Click to reveal answer
intermediate
Can triggers replace application code for some tasks? Why or why not?
Yes, triggers can handle some tasks inside the database itself, reducing the need for extra code in applications and ensuring rules are always followed.
Click to reveal answer
What event can cause a trigger to run?
✗ Incorrect
Triggers run automatically when data changes, like inserting, updating, or deleting rows.
Which of these is a main reason to use triggers?
✗ Incorrect
Triggers automate tasks like updating related data or enforcing rules when data changes.
Triggers help keep data consistent by:
✗ Incorrect
Triggers run code to check or fix data automatically when it is inserted, updated, or deleted.
When is a trigger NOT useful?
✗ Incorrect
Triggers do not create reports; they react to data changes.
Triggers run:
✗ Incorrect
Triggers run automatically when data is inserted, updated, or deleted.
Explain in your own words why triggers are important in databases.
Think about how triggers help keep data correct without extra effort.
You got /4 concepts.
Describe a real-life example where a trigger could help manage data automatically.
Consider situations like updating stock after a sale or logging changes.
You got /4 concepts.