0
0
SQLquery~5 mins

Why triggers are needed in SQL - Quick Recap

Choose your learning style9 modes available
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?
AInserting data into a table
BOpening a database connection
CRunning a SELECT query
DClosing the database
Which of these is a main reason to use triggers?
ATo automate repetitive tasks in the database
BTo speed up SELECT queries
CTo create user interfaces
DTo store large files
Triggers help keep data consistent by:
AEncrypting data on disk
BBacking up the database every hour
CAutomatically checking or updating data when changes happen
DAllowing multiple users to edit the same data simultaneously
When is a trigger NOT useful?
AFor logging changes to data
BFor automatically updating related tables
CFor enforcing business rules inside the database
DFor creating reports from data
Triggers run:
AManually by the user
BAutomatically when specific data events occur
COnly during database backups
DOnly when the database starts
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.