MySQL 数据库查询某个表存不存在
SELECT
count( * )
FROM
INFORMATION_SCHEMA.TABLES
WHERE
table_schema = ( SELECT DATABASE ( ) )
AND table_name = 'table_name'
AND table_type = 'BASE TABLE';
Talk is cheap. Show me the code.
SELECT
count( * )
FROM
INFORMATION_SCHEMA.TABLES
WHERE
table_schema = ( SELECT DATABASE ( ) )
AND table_name = 'table_name'
AND table_type = 'BASE TABLE';