Recall & Review
beginner
What is a trigger in a database?
A trigger is a special 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 a database?
Triggers help keep data correct and consistent by automatically checking or changing data when something happens, without needing a person to do it manually.
Click to reveal answer
intermediate
How do triggers help with data integrity?
Triggers can stop wrong data from being saved or fix data right away, so the database always stays accurate and reliable.
Click to reveal answer
beginner
Give an example of when a trigger is useful.
For example, a trigger can automatically update a 'last_modified' date whenever a record changes, so you always know when data was last updated.
Click to reveal answer
intermediate
Can triggers help automate tasks in the database?
Yes, triggers can run tasks automatically like sending alerts, updating related tables, or logging changes without extra work from users.
Click to reveal answer
What event can cause a trigger to run in PostgreSQL?
✗ Incorrect
Triggers run automatically when data changes, like inserting, updating, or deleting rows.
Why are triggers useful for data integrity?
✗ Incorrect
Triggers help keep data correct by running checks or updates when data changes.
Which of these is a common use of triggers?
✗ Incorrect
Triggers often update fields like 'last_modified' automatically when data is changed.
Can triggers run without user action after setup?
✗ Incorrect
Triggers run automatically when their event happens, no manual action needed.
Which of these is NOT a reason to use triggers?
✗ Incorrect
Triggers do not affect network speed; they help automate tasks and keep data consistent.
Explain why triggers are important in maintaining data integrity in a database.
Think about how triggers act like automatic helpers that watch data changes.
You got /4 concepts.
Describe a real-life example where a trigger could automate a task in a database.
Consider tasks that happen every time data changes without needing a person to do them.
You got /4 concepts.