How to drop a table, the name with '\t'?

I created two tables one of which contains ‘\t’. I want to drop the table with ‘\t’.
Such as ‘test\t’ and ‘test’. I want to drop ‘test\t’ table.

in this way?

(root@127.0.0.1) [test]>create table t_\t (id int);
Query OK, 0 rows affected (0.17 sec)

(root@127.0.0.1) [test]>show tables;
±------------------+
| Tables_in_test |
±------------------+
| t_\t |
±------------------+
18 rows in set (0.00 sec)

(root@127.0.0.1) [test]>drop table t_\t;
Query OK, 0 rows affected (0.28 sec)

(root@127.0.0.1) [test]>show tables;
±------------------+
| Tables_in_test |
±------------------+
±------------------+
17 rows in set (0.00 sec)

No, ‘\t’ is translated into a tab character, not the ‘\t’ of a string. It is displayed with multiple spaces, but it cannot be searched with spaces

Yes, you just need to quote the table name.

sql> SHOW TABLES;
+----------------+
| Tables_in_test |
+----------------+
| \t             |
+----------------+
1 row in set (0.0008 sec)

sql> DROP TABLE `\t`;
Query OK, 0 rows affected (0.4086 sec)

Give me the results of your show create table and I’ll try it out

use command {show tables like 'ex_secure_TM_ROLE_UPLOAD\t ’ } and command {show tables like 'ex_secure_TM_ROLE_UPLOAD '} is can’t find table also. In the first commad have one \t and one space, and the second only have one space.

use command {show tables like ‘ex_secure_TM_ROLE_UPLOAD\t’} can find this table, but use command {show create table ex_secure_TM_ROLE_UPLOAD\t} can’t find this table.

I can only provide photos of the results, because it is in a production environment.



You can use vim to write SQL files, source can be deleted. The above two diagrams show creating and deleting tests. The tmp.txt file is also here, you notice the comments under the changes

tmp.txt (48 Bytes)

1 Like

I will be try later, thanks. I’ll give you feedback if it works.

OK Note the following table specification

It works. I use vim write a SQL file, and input a [tab] in the table name.