MYSQL判断某个表是否已经存在

方法一、
You don't need to count anything. SELECT 1 FROM testtable LIMIT 1; If there's no error, table exists.
方法二、
Or, if you want to be correct, use INFORMATION_SCHEMA. SELECT * FROM information_schema.tables WHERE table_schema = 'yourdb' AND table_name = 'testtable' LIMIT 1;

方法三、 Alternatively, you can
use SHOW TABLES SHOW TABLES LIKE 'yourtable'; If there is a row in the resultset, table exists.

个人觉得方法三很不错

FROM: http://stackoverflow.com/questions/8829102/mysql-check-if-table-exists-without-using-select-from#8829109

原文地址:https://www.cnblogs.com/blogsme/p/3412178.html