Bird
0
0

Consider a DELETE trigger that prevents deletion if the employee's salary is above 100000. What will happen if you try to delete such an employee?

medium📝 query result Q5 of 15
SQL - Triggers
Consider a DELETE trigger that prevents deletion if the employee's salary is above 100000. What will happen if you try to delete such an employee?
AThe trigger deletes the row but logs a warning
BThe deletion is blocked and an error is raised
CThe trigger ignores the salary and deletes the row
DThe employee is deleted anyway
Step-by-Step Solution
Solution:
  1. Step 1: Understand conditional DELETE triggers

    Triggers can check conditions and raise errors to block deletes.
  2. Step 2: Effect of salary condition

    If salary > 100000, trigger raises error and stops deletion.
  3. Final Answer:

    The deletion is blocked and an error is raised -> Option B
  4. Quick Check:

    Conditional DELETE trigger can block deletion [OK]
Quick Trick: Use triggers to block deletes by raising errors [OK]
Common Mistakes:
  • Assuming trigger cannot block deletes
  • Thinking deletion proceeds despite condition
  • Confusing logging with blocking

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes