SQL - TriggersConsider 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 warningBThe deletion is blocked and an error is raisedCThe trigger ignores the salary and deletes the rowDThe employee is deleted anywayCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand conditional DELETE triggersTriggers can check conditions and raise errors to block deletes.Step 2: Effect of salary conditionIf salary > 100000, trigger raises error and stops deletion.Final Answer:The deletion is blocked and an error is raised -> Option BQuick 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 deletesThinking deletion proceeds despite conditionConfusing logging with blocking
Master "Triggers" in SQL9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More SQL Quizzes Common Table Expressions (CTEs) - CTE referencing another CTE - Quiz 12easy Database Design and Normalization - Denormalization and when to use it - Quiz 3easy Indexes and Query Performance - Why indexes matter - Quiz 3easy Indexes and Query Performance - EXPLAIN plan for query analysis - Quiz 3easy Stored Procedures and Functions - CURSOR concept and usage - Quiz 15hard Stored Procedures and Functions - CREATE PROCEDURE syntax - Quiz 6medium Stored Procedures and Functions - Why stored procedures are needed - Quiz 2easy Transactions and Data Integrity - COMMIT and ROLLBACK behavior - Quiz 11easy Transactions and Data Integrity - Auto-commit behavior - Quiz 6medium Window Functions Fundamentals - OVER clause with PARTITION BY - Quiz 8hard