0

I just created a MySQL Table called "trigger". The Problem now: I want to "drop table trigger;" This is not working. (Syntax error...) because it recognizes trigger not as name but as a trigger.

How do I do drop a table Named "trigger"?

Mureinik
  • 297,002
  • 52
  • 306
  • 350
Pätsn
  • 66
  • 3
  • 3
    If reserved word is used as object name then it must be quoted with backticks: ```drop table `trigger`;```. But reserved words as object names usage is bad practice - do it never. – Akina Sep 15 '21 at 11:01
  • I am actually new to MySQL and had to learn it the hard way... – Pätsn Sep 15 '21 at 11:07
  • [MySQL 8.0 Reference Manual / Language Structure / Schema Object Names](https://dev.mysql.com/doc/refman/8.0/en/identifiers.html) - study. – Akina Sep 15 '21 at 11:08

1 Answers1

2

You can escape a name with backticks. In your case:

DROP TABLE `trigger`;
Mureinik
  • 297,002
  • 52
  • 306
  • 350