SELECT
count( * )
FROM
INFORMATION_SCHEMA.TABLES
WHERE
table_schema = ( SELECT DATABASE ( ) )
AND table_name = 'table_name'
AND table_type = 'BASE TABLE';
MySQL 数据库查询某个表存不存在
于 2022-04-20 12:01:15 首次发布
SELECT
count( * )
FROM
INFORMATION_SCHEMA.TABLES
WHERE
table_schema = ( SELECT DATABASE ( ) )
AND table_name = 'table_name'
AND table_type = 'BASE TABLE';