Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does DROP TRIGGER work in mysql?

Tags:

sql

mysql

I have a question about how DROP TRIGGER works.

I used this command to drop triggers:

DROP TRIGGER IF EXISTS `database`.`mytrigger`;

But my qquestion is, u can drop a trigger selecting it with table name? for example:

DROP TRIGGER IF EXISTS `table`.`mytrigger`;

I tried it but the trigger is not deleted when i set tablename.

Thanks!

like image 901
Stefan Luv Avatar asked May 19 '26 20:05

Stefan Luv


1 Answers

No, because that doesn't uniquely identify a trigger, and it ends up looking like you're trying to say you have a database called table anyway. If you just want to leave off the database name, you don't need to replace it with anything:

DROP TRIGGER IF EXISTS `mytrigger`;

Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!