Question: MySQL - Triggers - after I created the trigger and ran delete query, it gave me error code 1054: Unknown column 'Bird.btag' in 'where clause'
MySQL - Triggers - after I created the trigger and ran delete query, it gave me error code 1054: Unknown column 'Bird.btag' in 'where clause'
The CTO has observed that some of the lesser-paid application developers seem incapable of following instructions. Instead of deleting birds at the User level in the type hierarchy, i.e., by targeting the User table, some of the developers continue to delete birds at the Bird level. As a result, the CTO has asked you to safeguard the database by creating a row-level trigger on the Bird table that, if a Bird is deleted, cascades the deletion to the User table.
DELIMITER $$ CREATE TRIGGER deletion AFTER DELETE ON Bird FOR EACH ROW BEGIN DELETE FROM User Where User.tag = Bird.btag; END
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
