lon*_*eck 14
select count(*)
from information_schema.tables
where table_type = 'BASE TABLE'
and table_schema = 'your_database_name_here'
Run Code Online (Sandbox Code Playgroud)
Mif*_*Fox 12
SELECT COUNT(DISTINCT `table_name`) FROM `information_schema`.`columns` WHERE `table_schema` = 'your_db_name'
Run Code Online (Sandbox Code Playgroud)
将返回数据库中实际的表(或视图)数.如果该数字为0,则表没有表格.
小智 6
要获取 MySQL 中没有表的所有数据库的列表:
use information_schema
select schema_name from `schemata` s
left join `tables` t on s.schema_name = t.table_schema
where t.table_name is null
;
Run Code Online (Sandbox Code Playgroud)
干杯,基督徒
| 归档时间: |
|
| 查看次数: |
17346 次 |
| 最近记录: |