Mysql查询某个表是否存在于某个数据库中

Mysql已知数据库名和表名,想查询该表存在于该数据库中

(Mysql查询某个表是否存在于某个数据库中)

举例:

​ 数据库名 debug_for_me

​ 表名 t_source

​ sql语句

SELECT count(*) FROM information_schema.tables WHERE table_schema = 'debug_for_me' AND table_name = 't_source' AND table_type = 'BASE TABLE'

返回1则存在,返回0则不存在

posted @ 2021-10-09 11:37  南风丶轻语  阅读(560)  评论(0编辑  收藏  举报