mysql 删除带有空格的表

今天,开发和我说,建库的时候不小心加了个空格,让我给删掉

mysql> show tables;
+----------------------------+
| Tables_in_medicare         |
+----------------------------+
| kb_disease_category        |
| kb_diseasecategory_disease |
| t _tmp                     |
+----------------------------+
3 rows in set (0.00 sec)

然后,我试了加双引号,删除。但是却报如下的错误:

mysql> drop table "t _tmp";
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"t _tm"' at line 1

后来上网查后,加反引号可以

mysql> drop table `t _tmp`;
Query OK, 0 rows affected (0.11 sec)

mysql> show tables;
+----------------------------+
| Tables_in_medicare         |
+----------------------------+
| kb_disease_category        |
| kb_diseasecategory_disease |
+----------------------------+
2 rows in set (0.00 sec)

 

posted @ 2018-04-26 15:53  bianxiaobian  阅读(541)  评论(0)    收藏  举报