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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!